You can use Optional Float, stick a !
at the end if you know it to be a Float, or use if/let
let floatConversion = Float("5.6")
The best way to handle this is direct casting:
extension String {
var floatValue: Float {
return (self as NSString).floatValue
}
}
Now you can just call
var floatConversion = "5.6".floatValue