Skip to content

Instantly share code, notes, and snippets.

Last active May 23, 2020
What would you like to do?
CLLocationManager Set up
import UIKit
import CoreLocation
class ViewController: UIViewController {
private let locationManager = CLLocationManager()
override func viewDidLoad() {
locationManager.delegate = self //Set our controller as delegate
locationManager.desiredAccuracy = kCLLocationAccuracyBest //Switch location manager in best accuracy mode
locationManager.requestAlwaysAuthorization() //Ask user permissions about location detection
locationManager.startUpdatingLocation() //Start user location detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment