I have a button, and the button name is an integer.
correctAnswer = randomNumber1 + randomNumber2 button1.setTitle("\(correctAnswer)", forState: UIControlState.Normal)
I am trying to check the title of a button to convert it to an integer and use it in an if statement, but could not get it to work.
button1.titleLabel?.text?.toInt() if button1.titleLabel == correctAnswer {
I'm new to fast, I might even have a problem with my approach, your help would be appreciated.
source share