Swift 2.3 NSUnitLength.kilometers is an instance variable not a class variable

Originator:gayle
Number:rdar://27462195 Date Originated:7/20/2016
Status:Fixed Resolved:Xcode 10 Beta 3
Product:iOS Product Version:iOS 10
Classification:Bug Reproducible:YES
 
All the new NSUnit* class var's are instance var's in when you display the class definition. So you can't use the builtins for Swift 2.3 like you can in Swift 3 and Objective-C

Steps to Reproduce:
let distance = NSMeasurement(doubleValue: 5, unit: NSUnitLength.kilometers)

// Compile Error: Instance member `kilometers` cannot be use on type `NSUnitLength`


Expected Results:
// Expect the following to compile
let distance = NSMeasurement(doubleValue: 5, unit: NSUnitLength.kilometers)


// Works in Objective-C
NSMeasurement* distance = [[NSMeasurement alloc] initWithDoubleValue:5 unit: [NSUnitLength kilometers]];

// Works in Swift 3
let distance = Measurement(value: 5, unit: UnitLength.kilometers)


Actual Results:
let distance = NSMeasurement(doubleValue: 5, unit: NSUnitLength.kilometers)

// Compile Error: Instance member `kilometers` cannot be use on type `NSUnitLength`

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!