class ViewController: UIViewController{ //... } // MARK: - LocationManager Delegate and Helper Functions extension ViewController: CLLocationManagerDelegate{ // Setup Location Manager function func setupLocationManager(){ locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest } // Check when location services are enabled func checkLocationServices(){ if CLLocationManager.locationServicesEnabled(){ setupLocationManager() } else { // Inform the user how to enable locaiton services in iOS Settings } } }