i wrote a code to convert string to double but gives error :
Cannot convert the expression's type 'Double' to type 'NSString'
and my code is :
var first = previewLable.text
var second = label1.text
var number1: Double = (first as NSString).doubleValue
var number2: Double = (second as NSString).doubleValue
what i have to do to fix this error ???
Thanks
Also if you're in Swift 2 you can use
Double("3.141592")
which gives an Optional Double, depending on whether it could be parsed
Double("hi")
would give nil
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