[Swift2.0] UInt32, Int32, and the other fixed size type should be AnyObject.

Originator:hkato193
Number:rdar://22264364 Date Originated:13-Aug-2015 04:20 AM
Status:Duplicate of 18025596 (Open) Resolved:
Product:iOS SDK Product Version:9.0
Classification:Enhancements Reproducible:Always
 
Summary:
In Swift2.0, Int/UInt type can be AnyObject. But Int32/UInt32 cannot be AnyObject. I think these fixed size types should also be 'AnyObject'.

Because, we have to write many cast code as follows:

let output = AVAssetReaderTrackOutput(track: compoVideoTrack,
    outputSettings: [String(kCVPixelBufferPixelFormatTypeKey) : NSNumber(unsignedInt:kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange),
    String(kCVPixelBufferIOSurfacePropertiesKey) : [:] as NSDictionary])

Most of codes using AVFoundation are similar with above 'castful' & ugly code. AVF uses OSType(is typealias to UInt32) anywhere.

Steps to Reproduce:
// 1
let uValue: UInt = 10
let foo: AnyObject = uValue

// 2
let u32Value: UInt32 = 10
let bar: AnyObject = u32Value

Expected Results:
We can compile both 1 & 2.

Actual Results:
Only 1 is compiled. 2 become compile error.

Version:
Xcode Version 7.0 beta 5 (7A176x)

Notes:


Configuration:
Swift2.0

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!