title: How to set Mapkit user tracking button state
body: <p>I've created a map with a user tracking button on the top right corner. I was wondering how I would be able to set the state to "followWithHeadlights" by default on load so that it follows the users current position just like you would have on GPS?</p>
  
  <p><strong>Current behaviour on load:</strong>
  <a href="https://i.stack.imgur.com/xxZsH.png" rel="nofollow noreferrer">Button current behaviour</a></p>
  
  <p><strong>Desired behaviour on load:</strong>
  <a href="https://i.stack.imgur.com/ArdFW.png" rel="nofollow noreferrer">Button desired behaviour</a></p>
  
  <p><strong>Code snippet:</strong></p>
  
  <pre><code>func setUserTrackingButton() {
  
      // Mapkit tracking button
      let trackingButton: MKUserTrackingBarButtonItem = MKUserTrackingBarButtonItem.init(mapView: mapView)
      trackingButton.customView?.tintColor = UIColor(red:0.01, green:0.81, blue:0.37, alpha:1.0)
      trackingButton.customView?.frame.size = CGSize(width: 50, height: 50)
  
      let toolBarFrame = CGRect(origin: CGPoint(x: 0, y: 0) , size: CGSize(width: 50, height: 50))
      let toolbar = UIToolbar.init(frame: toolBarFrame)
      toolbar.barTintColor = UIColor.white
      toolbar.isTranslucent = true
      let flex: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)
      toolbar.items = [flex, trackingButton, flex]
  
      let origin = CGPoint(x: self.view.frame.size.width - 85, y: 60)
      let roundedSquare: UIView = UIView(frame: CGRect(origin: origin, size: CGSize(width: 50, height: 50)))
      roundedSquare.backgroundColor = UIColor.white
      roundedSquare.layer.cornerRadius = 5
      roundedSquare.layer.masksToBounds = true
  
      roundedSquare.addSubview(toolbar)
      mapView.addSubview(roundedSquare)
  }
  </code></pre>
  
  <p><strong>ViewDidLoad includes:</strong></p>
  
  <pre><code>mapView.setUserTrackingMode(MKUserTrackingMode.followWithHeading, animated: true)
  </code></pre>
  
  <p>Thanks!</p>