leeo-ios-sdk
v0.1.1
Published
Leeo iOS SDK – trip tracking and incident reporting (DriveKit + fleet-service). For React Native or CocoaPods apps.
Readme
Leeo iOS SDK
Swift package for trip tracking and incident reporting. Uses DriveQuant (DriveKit) and calls fleet-service for setup.
Installation (for clients)
The SDK is distributed via Swift Package Manager from your Git repository.
1. Add the package in Xcode
- File → Add Package Dependencies…
- Enter the package URL, e.g.
https://github.com/leeoinsurance/leeo-ios-sdk.git(use your actual repo URL). - Choose Up to Next Major Version and set the minimum version (e.g.
0.1.0) or Exact for a specific tag. - Add the LeeoSDK library to your app target.
2. Or add to your own Swift package
In your Package.swift:
dependencies: [
.package(url: "https://github.com/leeoinsurance/leeo-ios-sdk.git", from: "0.1.0"),
],
targets: [
.target(name: "YourApp", dependencies: ["LeeoSDK"]),
]3. Versioning for clients
Create Git tags for each release (e.g. 0.1.0, 0.1.1) so clients can pin versions. SPM resolves versions from tags.
# From repo root (or use the script)
./scripts/tag-release.sh 0.1.0
# Or manually:
git tag -a 0.1.0 -m "Release 0.1.0"
git push origin 0.1.0App configuration
- Capabilities: enable Background Modes → Location updates (and optionally Background fetch) for trip recording.
- Info.plist: add location and motion usage descriptions (required by DriveKit), e.g.
NSLocationWhenInUseUsageDescription,NSLocationAlwaysAndWhenInUseUsageDescription,NSMotionUsageDescription.
Use the API
The SDK defaults to production base URL https://api.leeoinsurance.com. Override baseUrl only for dev/stage.
import LeeoSDK
// Omit baseUrl to use production (LeeoConfiguration.defaultBaseUrl)
let config = LeeoConfiguration(
sdkKey: "your-sdk-key",
driverId: "driver-123",
driverAttributes: LeeoDriverAttributes(
firstName: "Jane",
lastName: "Doe",
email: "[email protected]",
phoneNumber: "+1234567890"
)
)
let notification = LeeoTripNotification(title: "Trip", content: "Recording...", iconId: 0)
Leeo.setup(configuration: config, tripNotification: notification) { success, error in
if success { /* ready for trips */ }
}
Leeo.startTrip(trackingId: "trip-456") { success, _ in /* ... */ }
Leeo.stopTrip { _, _ in }
Leeo.startShift(shiftId: "shift-1") { success, _ in /* ... */ }
Leeo.stopShift { _, _ in }
Leeo.openIncidentReportingWebPage { error in /* ... */ }
Leeo.teardown { }Setup (backend)
- Endpoint:
POST {baseUrl}/fleet/v1/sdk/setup - Body:
sdk_key,driver_id,first_name,last_name,email,phone_number,sdk_family: "leeo"
Flows
- Manual:
startTrip(trackingId:)/stopTrip() - Shift:
startShift(shiftId:)/stopShift()(auto trip detection)
See LEEO_SDK_DESIGN.md for full design.
TestFlight (demo app)
The demo app is provided as an Xcode project that depends on the SDK via GitHub (same as clients), so you can test the full client flow and then ship to TestFlight.
1. Publish a version for the SDK (one-time or per release)
So the demo app can resolve the package, create and push a tag:
./scripts/tag-release.sh 0.1.0Use the same version the demo project expects (it uses “Up to Next Major” from 0.1.0).
2. Open the demo project
- Open
Examples/LeeoSDKDemo/LeeoSDKDemo.xcodeprojin Xcode. - Xcode will resolve the LeeoSDK package from
https://github.com/leeoinsurance/leeo-ios-sdk.git(ensure the repo and tag are available).
3. App Store Connect
- Create an app record (e.g. Leeo SDK Demo) with bundle ID
com.leeoinsurance.leeo-sdk-demo(or match whatever you set in the project).
4. Signing
- Select the LeeoSDKDemo target → Signing & Capabilities.
- Set Team to your Apple Developer team (and bundle ID to match App Store Connect).
5. Archive and upload
- Select Any iOS Device (or a connected device).
- Product → Archive.
- In the Organizer: Distribute App → App Store Connect → Upload → choose the archive.
6. TestFlight
- In App Store Connect → your app → TestFlight, add internal testers (team) or external testers (review required). Install via the TestFlight app.
For automation, use Fastlane (match, upload_to_testflight) or a GitHub Action that archives and uploads on tag or push.
