How I can center the map on user's location in swift?
<p>I'm writing an app and I have an embedded mapview to show user's his location. This is my code so far:</p>

<pre><code>class YourCurrentLocation: UIViewController, CLLocationManagerDelegate {

    @IBOutlet weak var mapView: MKMapView!

    var locationManager = CLLocationManager()
    let regionRadius: CLLocationDistance = 1000

    func checkLocationAuthorizationStatus() {
        if CLLocationManager.authorizationStatus() == .AuthorizedWhenInUse {
            mapView.showsUserLocation = true
            centerMapOnLocation(locationManager.location!, map: mapView, radius: regionRadius)
        } else {
            locationManager.requestAlwaysAuthorization() //requestWhenInUseAuthorization()
        }
    }



    func centerMapOnLocation(location: CLLocation, map: MKMapView, radius: CLLocationDistance) {
        let coordinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate,
            radius * 2.0, radius * 2.0)
        map.setRegion(coordinateRegion, animated: true)
    }


    override func viewDidLoad() {
        super.viewDidLoad()

       // mapView.delegate = self


        if CLLocationManager.locationServicesEnabled()
        {
            //locationManager = CLLocationManager()
            locationManager.delegate = self
            locationManager.requestAlwaysAuthorization()
            locationManager.desiredAccuracy = kCLLocationAccuracyBest
            locationManager.startUpdatingLocation()
            print("location enabled")
            checkLocationAuthorizationStatus()            
        }
        else
        {
            print("Location service disabled");
        }


        // Do any additional setup after loading the view.
    }

}
</code></pre>

<p>I also added the two entries to my plist:</p>

<pre><code>NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
</code></pre>

<p>and also in my xcode I have set to emulate the GPS data on london, UK.</p>

<p>When I run the app - I see the map, but london is not marked. What am I doing wrong?</p>

<p>Btw, I had to comment out this line:</p>

<pre><code>//mapView.delegate = self
</code></pre>

<p>in <code>viewDidLoad()</code>, otherwise I had the error: </p>

<pre><code>Cannot assign value of type YourCurrentLocation to type MKMapViewDelegate
</code></pre>

<p>and I'm not sure if that's a part of the problem here. </p>

<p>I want to achieve the effect when I display to the user map and a point marked on that map with his location. Can you help me with that?</p>