title: How to use barometer to get more accurate altitude data on iOS
body: <p>I heard that since the iPhone 6, iPhones have a barmoter that can help get more accurate altitude readings rather than using the GPS data alone. </p>
  
  <p>How can I utilize this barometer sensor to get a more accurate altitude?  Right now, I'm getting the altitude using this code:</p>
  
  <pre><code>// delegate method, constantly read latitutde and longitutde
  func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
      let userLocation:CLLocation = locations[0] as CLLocation
  
      // get the lat/long/alt values
      let alt = userLocation.altitude
  
      altLabel.text = String(alt)
  }
  </code></pre>