Quickstart: iOS
Add FounderHQ to a Swift or SwiftUI app.
Add the package, create the client once, and see your first event in FounderHQ. About 5 minutes.
Before you start
You need a FounderHQ account, Xcode, an app targeting iOS 15 or later, and a publishable key. In the app, open Sequences → Settings → Event API keys, create a key for Browser/mobile, and copy it. The full key is shown only once.
Add FounderHQEvents
In Xcode, open File → Add Package Dependencies and add the
https://github.com/FounderHQ/founderhq-events-ios repository, version
0.8.0 or later. Add the FounderHQEvents library to your
app target.
CocoaPods instead? Add pod 'FounderHQEvents', '~> 0.8.0' to your Podfile and run
pod install.
Create the client once
Create one shared client and hold it for the life of the app.
import FounderHQEvents
let events = FounderHQEvents(apiKey: "fhq_pk_XXXX")App lifecycle, UIKit screens, sessions, and on-device queuing start immediately. The queue survives a restart, so events captured offline still arrive.
To change the defaults, pass a configuration.
let events = FounderHQEvents(
apiKey: "fhq_pk_XXXX",
configuration: FounderHQEventsConfiguration(captureScreens: false)
)Track SwiftUI screens
UIKit screens are captured for you. SwiftUI views are not, so mark the ones you care about.
PricingView()
.founderHQScreen("Pricing", client: events)Identify and capture
events.identify("user_8421", properties: ["email": "jane@acme.com"])
events.capture("trial.started", properties: ["plan": "pro"])Pass your own stable user ID, not an email. Call events.reset() on
sign-out.
Handling a universal link? Pass it on, so the campaign that brought the person survives the install.
events.captureDeepLink(url)Verify
- Run the app on a simulator or device and trigger the event.
- In FounderHQ, open Sequences → Events.
- You see
trial.startedwithplan: pro, a$session_start, and a$screenfor the screen you opened. - Open Sequences → Contacts. Jane is there with her email.
Events can take a few seconds to appear. The SDK batches them. To send
immediately, await events.flush().
Troubleshoot
No $screen events from SwiftUI
Only UIKit screens are automatic. Add .founderHQScreen(_:client:) to
each SwiftUI view you want to see.
Purchases are not attributed
In-app purchases need the purchase claim flow, not capture. See
Mobile purchase claims.