Swift: Annotate Obj-C Collection Types

Originator:wetzeal
Number:rdar://19457238 Date Originated:13-Jan-2015 11:18 AM
Status:Duplicate/6294649/Closed Resolved:20-Jan-2015
Product:Developer Tools Product Version:Xcode 6.1.1 (6A2006)
Classification:Enhancement Reproducible:Always
 
Summary:
Working with Objective-C objects which have NSArray and NSDictionary properties is cumbersome and error prone in Swift, because the collections or members of the collection must constantly be cast to the expected type.

There should be annotations (similar to NS_DESIGNATED_INITIALIZER) to annotate NSArray and NSDictionary properties with the types contained in them. Swift should automatically cast these collections to correctly typed collections when they are accessed, with expected runtime errors if the cast fails.

This would greatly simplify working with properties like UINavigationController.viewControllers or NSURL.pathComponents.

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!