Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.