iOS App
This guide is for developers building or customizing the LeadHub iOS companion app. The app source code is written in Swift and targets iPhone and iPad.
Requirementsโ
- Xcode 15 or later (macOS only)
- Swift 5.9 or later
- iOS deployment target: iOS 15.0 minimum
- An Apple Developer account (required for TestFlight and App Store distribution)
- A LeadHub instance with a valid HTTPS URL and an active API key
Project Setupโ
- Open the
ios/folder from your LeadHub purchase in Xcode. - Open the
.xcworkspacefile (not the.xcodeproj) if CocoaPods or Swift Package Manager dependencies are present. - Select your development team in the project's Signing & Capabilities settings.
- Build and run on a simulator or device.
Architectureโ
The app uses a standard iOS architecture:
- URLSession with a custom API client for HTTP calls to the LeadHub REST API
- Combine or async/await for asynchronous operations
- SwiftUI for the user interface
- CoreData for local caching of leads between sessions
- Apple Push Notification Service (APNs) for push notifications
API keys are stored in the iOS Keychain using the Security framework.
Authentication Flowโ
- The user enters their LeadHub instance URL and API key on the onboarding screen.
- The app makes a
GET /api/v1/healthrequest to verify the instance is reachable over HTTPS. - It verifies the API key is valid by making a test authenticated request.
- The URL and API key are stored in the Keychain.
Push Notificationsโ
Push notifications use Apple Push Notification Service (APNs).
- In your Apple Developer account, create an APNs key (.p8 file) under Certificates, Identifiers & Profiles โ Keys.
- Note the Key ID and your Team ID.
- In your LeadHub backend configuration, set
APNS_KEY,APNS_KEY_ID,APNS_TEAM_ID, andAPNS_BUNDLE_ID. - In Xcode, enable the Push Notifications capability under Signing & Capabilities.
The app registers for push notifications on first launch and sends the device token to the LeadHub backend via the API.
Building for Distributionโ
- Archive the app via Product โ Archive in Xcode.
- In the Organizer window, click Distribute App.
- Choose App Store Connect for App Store distribution, or TestFlight for beta testing.
- Follow the Xcode prompts to upload.
API Endpoints Usedโ
| Endpoint | Purpose |
|---|---|
GET /api/v1/health | Verify instance connectivity |
GET /api/v1/leads | Load leads list |
GET /api/v1/leads/{id} | Load lead detail |
PATCH /api/v1/leads/{id} | Update lead status or stage |
POST /api/v1/leads/{id}/tags | Add tag to lead |
GET /api/v1/pipelines | Load pipeline list for stage picker |
Minimum Required API Key Scopesโ
| Scope | Reason |
|---|---|
read:leads | View leads |
write:leads | Update lead status, stage, and tags |
read:pipelines | Populate the pipeline stage picker |
App Store Privacy Disclosureโ
When submitting to the App Store, declare the following data usage in your App Privacy section:
- Contact Info (email, phone) โ collected from leads, not users
- Identifiers (API key) โ linked to the user, used for authentication
- Usage Data โ not collected