I'm trying to convert numbers taken from a UITextField, which I presume, are actually Strings, and convert them to Float, so I can multiply them.
I have two UITextfield
s which are declared as follows:
@IBOutlet var wage: UITextField
@IBOutlet var hour: UITextField
When the user presses a UIButton I want to calculate the wages the user earns, but I can't, as I need to convert them to floats first, before I can use them.
I know how to convert them to an integer by doing this:
var wageConversion:Int = 0
wageConversion = wage.text.toInt()!
However, I have no idea how to convert them to floats.
Question&Answers:os