Created
April 6, 2017 16:59
-
-
Save andrewxhill/4417ed600fc17af2ed846c4094098a9b to your computer and use it in GitHub Desktop.
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
class RideFinderViewController: UIViewController, CLLocationManagerDelegate { | |
let locationManager = CLLocationManager() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
locationManager.delegate = self | |
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters | |
locationManager.startUpdatingLocation() | |
} | |
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { | |
locationManager.stopUpdatingLocation() | |
guard let location = locations.last else { return } | |
handleLocation(location) | |
} | |
func handleLocation(_ location: CLLocation) { | |
let setStates = SetSDK.instance.getDestination(fromLocation: location.coordinate) | |
guard let states = setStates else { return } | |
populateDestinationSuggestionsFromSetStates(states) | |
} | |
func populateDestinationSuggestionsFromSetStates(_ setStates: [SetState]) { | |
// Custom code to populate your UI of destination suggestions | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment