title: Error when attempting to read heart rate from Watch
body: <p>I'm trying to build an app that reads the heart rate data from HealthKit and displays it in a table, but whenever I run the code I have it terminates because it finds a nil in the following method:</p>
  
  <p>extension InterfaceController: HeartRateDelegate {</p>
  
  <pre><code>func heartRateUpdated(heartRateSamples: [HKSample]) {
  
      guard let heartRateSamples = heartRateSamples as? [HKQuantitySample] else {
          return
      }
  
      DispatchQueue.main.async {
          self.heartRateSamples = heartRateSamples
          guard let sample = heartRateSamples.first else {
              return
          }
          let value = sample.quantity.doubleValue(for: HKUnit(from: "count/min"))
          let heartRateString = String(format: "%.00f", value)
          self.heartRateLabel.setText(heartRateString)//where it finds the nil
      }
  }
  </code></pre>
  
  <p>is there a way to wrap that line in an optional? it probably goes without saying but I'm pretty new to iOS programming </p>
  
  <p>EDIT: heartRateLabel is an outlet that I've connected in my storyboard (this is all in the watch interface controller), but I don't think I've initialized it properly. In the Interface Controller class I've written: </p>
  
  <p>class InterfaceController: WKInterfaceController {</p>
  
  <pre><code>@IBOutlet var heartRateLabel: WKInterfaceLabel!
  
  @IBOutlet var workoutButton: WKInterfaceButton!
  
  let healthKitManager = HealthKitManager.sharedInstance 
  
  var isWorkoutInProgress = false
  
  var workoutSession: HKWorkoutSession?
  
  var workoutStartDate: Date?
  
  var heartRateQuery: HKQuery?
  
  var heartRateSamples: [HKQuantitySample] = [HKQuantitySample]()
  </code></pre>
  
  <p>would I need to initialize it in this step? what would the syntax be?</p>