- Open the main project or workspace in Xcode.
- Go to
File > Add Packages.... - Enter the URL for this repository (https://github.com/Calindra/eitri-ios-geolocation) when prompted.
- Ensure the
EitriGeolocationproduct is added to the main target.
Your host app must include the following keys in its Info.plist file:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your app needs access to your location to provide location-based features.</string>If your app needs to access location when running in the background, you must also add:
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your app needs access to your location even when not in use to provide continuous location tracking.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Your app needs access to your location at all times to provide continuous location tracking.</string>Important Notes:
- Background location keys are only required if you use the
upgradeToBackgroundPermission()method from Bifrost - iOS will show a two-step permission flow: first "When in Use", then "Always Allow"
- The module does not include these keys by default - they must be added to your host app's Info.plist
- Customize the description strings to explain why your app specifically needs location access
To request reduced accuracy by default (iOS 14+):
<key>NSLocationDefaultAccuracyReduced</key>
<true/>import GeolocationModule
// [...]
let eitriMachineContext = EitriMachineInstanceManager.start()
// get main eitri-machine instance
let mainEitriMachine = eitriMachineContext.mainMachine
// configure
mainEitriMachine.configure(
// configure params
)
//register modules
mainEitriMachine.modules.register(module: GeolocationModule())