Skip to content

Instantly share code, notes, and snippets.

@rrecio
Created June 17, 2015 16:57
Show Gist options
  • Save rrecio/fc92005519e7a36f3853 to your computer and use it in GitHub Desktop.
Save rrecio/fc92005519e7a36f3853 to your computer and use it in GitHub Desktop.
core location playground
//: 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