I\'m new to Swift, how can I convert a String to CGFloat?
I tried:
var fl: CGFloat = str as CGFloat var fl: CGFloat = (CGFloat)str var fl: CGFloat = CGFl
You should cast string to double and then cast from double to CGFloat, Let try this:
string
double
CGFloat
let fl: CGFloat = CGFloat((str as NSString).doubleValue)