Skip to content

Instantly share code, notes, and snippets.

@Juanpe
Last active December 9, 2018 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Juanpe/65fc919e7cc145bfabee9e9a390df6e8 to your computer and use it in GitHub Desktop.
Save Juanpe/65fc919e7cc145bfabee9e9a390df6e8 to your computer and use it in GitHub Desktop.
class ViewControllerWithoutCL: UIViewController {
var locationProvider: UserLocationProvider
var userLocation: UserLocation?
init(locationProvider: UserLocationProvider) {
self.locationProvider = locationProvider
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func requestUserLocation() {
locationProvider.findUserLocation { [weak self] location, error in
if error == nil {
self?.userLocation = location
} else {
print("User can not be located 😔")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment