I have this code where the length and the width get multiplied but I need them to be 'Float' numbers and not 'integers'
// Outlets for square start
@IBOutlet weak var LengthForSquare: UITextField!
@IBOutlet weak var WidthForSquare: UITextField!
@IBOutlet weak var ResultForSquare: UILabel!
// Outlet for Square finish
@IBAction func AnswerForSquarePressed(_ sender: Any) {
ResultForSquare.text = ((LengthForSquare.text! as NSString).integerValue * (WidthForSquare.text! as NSString).integerValue ).description
}
I want to convert the 'integerValue' to a float but it shows an error every time I try.
It would be great if someone can help me with this.