title: How to show location on map view on swift? I believe my code is current but simulator doesn't show location or the blue dot?
body: <p>I am trying to show on my current location and a blue dot on the map using the map view on swift. However it does not show my location nor the blue dot I'm very positive of my code but I can't get it to show! it's probably an issue with the settings?</p>
  
  <pre><code>import UIKit
  import MapKit
  import CoreLocation
  
  class ViewController: UIViewController {
  
      @IBOutlet weak var mapView: MKMapView!
  
      let locationManager = CLLocationManager()
      let regionInMeters: Double = 1000
  
      override func viewDidLoad() {
          super.viewDidLoad()
          checkLocationServices()
      }
  
  
      func setupLocationManager() {
          locationManager.delegate = self
          locationManager.desiredAccuracy = kCLLocationAccuracyBest
      }
  
  
      func centerViewOnUserLocation() {
          if let location = locationManager.location?.coordinate {
              let region = MKCoordinateRegion.init(center: location, latitudinalMeters: regionInMeters, longitudinalMeters: regionInMeters)
              mapView.setRegion(region, animated: true)
          }
      }
      func checkLocationServices() {
          if CLLocationManager.locationServicesEnabled() {
              setupLocationManager()
              checkLocationAuthorrization()
          } else {
              // Show alert letting the user know they have to turn this on.
          }
      }
  
  
      func checkLocationAuthorrization() {
          switch CLLocationManager.authorizationStatus() {
          case .authorizedWhenInUse:
              mapView.showsUserLocation = true
              centerViewOnUserLocation()
              locationManager.startUpdatingLocation()
              break
          case .denied:
              // Show alret instructing them how to turn on permissions
              break
          case .notDetermined:
              break
          case .restricted:
              // Show alret letting them know what's up
              break
          case .authorizedAlways:
              break
          }
      }
  }
  
  
  
  
  extension ViewController: CLLocationManagerDelegate {
  
      func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
          guard let location = locations.last else { return }
          let center = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
          let region = MKCoordinateRegion.init(center: center, latitudinalMeters: regionInMeters, longitudinalMeters: regionInMeters)
          mapView.setRegion(region, animated: true)
      }
  
  
      func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
          checkLocationAuthorrization()
      }
  }
  </code></pre>