diff --git a/ProjectClock/AlarmActivationViewController.swift b/ProjectClock/AlarmActivationViewController.swift index 5527ad5..bfcc2d4 100644 --- a/ProjectClock/AlarmActivationViewController.swift +++ b/ProjectClock/AlarmActivationViewController.swift @@ -132,26 +132,10 @@ class AlarmActivationViewController: UIViewController /** Gets RPS choice */ - @IBAction func rockChoice(_ sender: Any) { - if rpsAction(choice: .rock)! { - endAlarm() - } else { - rpsResult.text = "Paper: You lost, try again" - } - } - @IBAction func paperChoice(_ sender: Any) { - if rpsAction(choice: .paper)! { - endAlarm() - } else { - rpsResult.text = "Scissors: You lost, try again" - } - } - @IBAction func scissorChoice(_ sender: Any) { - if rpsAction(choice: .scissors)! { - endAlarm() - } else { - rpsResult.text = "Rock: You lost, try again" - } + @IBAction func rpsChoice(_ sender: UIButton) + { + if rpsAction(choice: [.rock, .paper, .scissors][sender.tag])! { endAlarm() } + else { rpsResult.text = "\(["Paper", "Scissors", "Rock"][sender.tag]): You lost, try again" } } /** diff --git a/ProjectClock/Base.lproj/Main.storyboard b/ProjectClock/Base.lproj/Main.storyboard index d06cb26..bee0000 100644 --- a/ProjectClock/Base.lproj/Main.storyboard +++ b/ProjectClock/Base.lproj/Main.storyboard @@ -706,23 +706,23 @@ - + - - @@ -911,7 +911,7 @@ - +