Skip to content

Instantly share code, notes, and snippets.

@ngengesenior
Last active June 12, 2024 19:39
Show Gist options
  • Save ngengesenior/4e87aeec45dca9cb2bb6e2c922077dc2 to your computer and use it in GitHub Desktop.
Save ngengesenior/4e87aeec45dca9cb2bb6e2c922077dc2 to your computer and use it in GitHub Desktop.
override fun locationManager(manager: CLLocationManager, didUpdateLocations: List<*>) {
val location = didUpdateLocations.firstOrNull() as? CLLocation?
locationResultContinuation?.let {
if (it.isActive) {
if (location != null) {
it.resume(Result.success(location))
} else {
it.resumeWithException(Exception("No valid location found"))
}
locationResultContinuation = null
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment