Location Manager is a library written in Swift that makes it easy for you to use Apple CoreLocation services.
- iOS 13.0+
The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
The Package Manager is included in Swift 3.0 and above.
.package(url: "https://github.com/koombea/location-manager-ios", from: "1.0.0")
let status = await LocationManager.requestAuthorization(for: .whenInUse)
It must be used after request whenInUse
Read more from Apple Docs
let status = await LocationManager.requestAuthorization(for: .always)
NotificationCenter.default.addObserver(self, selector: #selector(yourSelector),
name: LocationManager.authorizationStatusChanged, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(yourSelector),
name: LocationManager.locationManagerDidFail, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(yourSelector),
name: LocationManager.locationUpdated, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(yourSelector),
name: LocationManager.authorizedBackgroundLocation, object: nil)