The following code doesn't work anymore in Beta 5.
let device = UIDevice.currentDevice()
if (device.systemVersion.bridgeToObjectiveC().floatValue < 8.0) {
[skipped]
}
Also, it's not possible to downcast a string to float.
let device = UIDevice.currentDevice()
let version: Float = device.systemVersion as Float
The snippet above returns the 'String' is not convertible to 'Float'
error.
Any ideas how should we test the OS version now? Thanks.
floatValue
is a method of NSString
.Since bridgeToObjectiveC()
is no longer available with Xcode 6 Beta 5, you can use the as
operator to cast your Swift String
to NSString
:
(device.systemVersion as NSString).floatValue
I am using this approach for now
("1.3" as NSString).floatValue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With