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 } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter