Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created April 6, 2017 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewxhill/4417ed600fc17af2ed846c4094098a9b to your computer and use it in GitHub Desktop.
Save andrewxhill/4417ed600fc17af2ed846c4094098a9b to your computer and use it in GitHub Desktop.
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