Convert optional string to double in Swift 3
问题 I have a option string and want to convert that to double. this worked in Swift 2 , but since converted to Swift 3, I am getting value of 0. var dLati = 0.0 dLati = (latitude as NSString).doubleValue I have check and latitude has a optional string value of something like -80.234543218675654 , but dLati value is 0 *************** ok, new update for clarity ***************** I have a viewcontroller which i have a button in it, and when the button is touched, it will call another viewcontroller