Skip to main content
Track user location to enable location-based messaging.

1. Add Location Permissions to Info.plist

Add these keys to your Info.plist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>We use your location to send relevant notifications</string>

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We use your location to send relevant notifications</string>

2. Initialize Location Module

import ZixflowLocation

let config = SDKConfigBuilder(apiKey: "YOUR_API_KEY")
    .addModule(LocationModule(
        config: LocationConfig(mode: .onAppStart)
    ))
    .build()

Zixflow.initialize(withConfig: config)

3. Location Update Modes

  • .onAppStart: Request location once when app starts
  • .onDemand: Request location manually when needed

4. Manual Location Update

// Request location update manually
Zixflow.location.requestLocationUpdate()

// Set last known location
if let location = locationManager.location {
    Zixflow.location.setLastKnownLocation(location)
}