Created
June 17, 2015 16:57
-
-
Save rrecio/fc92005519e7a36f3853 to your computer and use it in GitHub Desktop.
core location playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import CoreLocation | |
let locationMgr = CLLocationManager() | |
class GeoCordDelegate: NSObject, CLLocationManagerDelegate { | |
func locationManager(manager: CLLocationManager, didUpdateToLocation newLocation: CLLocation, fromLocation oldLocation: CLLocation) { | |
print("Updated Location: " + newLocation.description) | |
} | |
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) { | |
print("Error while updating location " + error.localizedDescription) | |
} | |
} | |
let geoCoordDelegate = GeoCordDelegate() | |
locationMgr.delegate = geoCoordDelegate | |
locationMgr.desiredAccuracy = kCLLocationAccuracyBest | |
locationMgr.startUpdatingLocation() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment