import UIKit class ViewController: UIViewController { // the timer calls a method (function) every x seconds // FINISH ME // create a variable called timer ??? ????? = Timer() // FINISH ME // Control + Drag your time label to here // Make sure it pops up and says connect @IBOutlet weak var timeLabel: UILabel! @objc func timerAction() { let formatter = DateFormatter() formatter.dateFormat = "hh:mm:ss a" // "a" prints "pm" or "am" let hourString = formatter.string(from: Date()) // "12 AM" // FINISH ME // Put the minutes and seconds onto the timerLabel (text field) // hourString is the variable that holds the formatted time // USE interpolation \(??) timeLabel.???? = "??????" } // FINISH ME // Control + Drag your start button to here @IBAction func startButtonEvent(_ sender: UIButton) { // FINISH ME // call the timer's invalidate() method (function) // this will shut down the current timer timer.????????? // just in case this button is tapped multiple times // start the timer // and call timerAction() every 1 second timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(timerAction), userInfo: nil, repeats: true) } // FINISH ME // Control + Drag your stop button to here @IBAction func stopButtonEvent(_ sender: UIButton) { timer.invalidate() // FINISH ME // set the timeLabel's text field to "00:00:00 --" timeLabel.????? = ??????? } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }