title: Reset the user's step count to 0
body: <p>I am working on a health care application with a pedometer function. I am using the CMPedometer class to start counting step, but I am looking for a way that can set the pedometer's Step Count to 0 after midnight and start counting steps for the next day (when movement is detected) and so on.</p>
  
  <p>I have tried messing around with NSDate classes but having a hard time actually connecting them to work out as explained above.</p>
  
  <pre><code>    myPedometer = CMPedometer()
  
      myPedometer.startUpdates(from: NSDate() as Date, withHandler: { (pedometerData, error) in
          if let e = error {
              print(e.localizedDescription)
              return
          }
          guard let data = pedometerData else {
              return
          }
          let myStep = data.numberOfSteps
          self.stepLabel.text = "\(myStep)"
  
  
          var date = NSDate
  
          if date = 24:00  {
              self.myPedometer.stopUpdates()
          }
  </code></pre>
  
  <p>I am not aware of how each day's step counts could possibly be reset even though I have tried using an if statement to stop pedometer updates.</p>
  
  <p>Also, X-Code keeps sending error messages for the last if statement saying "Cannot assign value of type 'int' to type 'NSDate.Type'.</p>