Skip to content

Repository files navigation

Eitri iOS Geolocation

Installation via Swift Package Manager (Xcode)

  1. Open the main project or workspace in Xcode.
  2. Go to File > Add Packages....
  3. Enter the URL for this repository (https://github.com/Calindra/eitri-ios-geolocation) when prompted.
  4. Ensure the EitriGeolocation product is added to the main target.

Configuration

Info.plist Requirements

Your host app must include the following keys in its Info.plist file:

For Foreground Location Access

<key>NSLocationWhenInUseUsageDescription</key>
<string>Your app needs access to your location to provide location-based features.</string>

For Background Location Access (Optional)

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

Optional: Default to Approximate Location

To request reduced accuracy by default (iOS 14+):

<key>NSLocationDefaultAccuracyReduced</key>
<true/>

Registering geolocation module

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())

How to use the module in your eitri-apps

Bifrost Geolocation API reference.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages