Fixed optional unwrapping

This commit is contained in:
Aaron
2021-01-22 12:56:52 -05:00
parent 259137170d
commit 083b5a05e0
3 changed files with 11 additions and 6 deletions
@@ -38,7 +38,7 @@ class AlarmActivationViewController: UIViewController
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(AlarmActivationViewController.playSound), userInfo: nil, repeats: true)
setAlarmType()
print(MathExpression.random())
//print(MathExpression.random())
}
@objc func playSound()
@@ -68,8 +68,13 @@ class AlarmActivationViewController: UIViewController
}
@IBAction func checkPuzzleSolution(_ sender: Any) {
if puzzleAnswers.contains(Int(puzzleAnswerInput.text!)!) {
print("alarm solved")
if let input = puzzleAnswerInput.text {
if let numericalInput = Int(input) {
if puzzleAnswers.contains(numericalInput) {
timer?.invalidate()
print("Alarm solved")
}
}
}
}
}