title: How to record start and end time in swift
body: <p>I am trying to write a basic timer app that will record the time you hit start and the time you hit end and compare them. All attempts I have made so far have not printed the time, defaulting to its original definition.</p>
  
  <pre><code>let date = Date()
  let calendar = Calendar.current
  let hourTime = calendar.component(.hour, from: date)
  let minutesTime = calendar.component(.minute, from: date)
  
  var TimeWhileGone=0
  
  @IBAction func EndTime(_ sender: Any) {
      var button2Alert = UIAlertController(title: "Title", message: "Your Timer have been going for \(minutesTime-TimeWhileGone) minutes!", preferredStyle: UIAlertControllerStyle.alert)
      self.present(button2Alert, animated: true, completion: nil)*/
  }
  
  @IBAction func startTime(_ sender: Any) {
      TimeWhileGone=minutesTime
  }
  </code></pre>