Setup LocationManager services upon app build

PHOTO EMBED

Wed Jun 02 2021 12:55:37 GMT+0000 (UTC)

Saved by @joeavargas

 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
        }
    }
 }
content_copyCOPY