SDKs
Swift SDK
The complete iOS surface: configuration, identity, events, and APNs enrolment.Install
pod 'Notifie', '0.1.0-beta.5'.package(url: "https://github.com/rohit1521/notifie", exact: "0.1.0-beta.5")Initialize
Only apiKey is required. Every other parameter has a working default.
import Notifie
Notifie.initialize(
apiKey: processInfo.notifieKey,
batchSize: 20,
flushInterval: 30,
maxQueueSize: 1000,
logLevel: .silent
)| Parameter | Default | Meaning |
|---|---|---|
apiKey | required | SDK ingest key |
baseURL | https://notifie.dev | Advanced override for local integration tests |
batchSize | 20 | Events per upload |
flushInterval | 30 | Seconds between automatic flushes |
maxQueueSize | 1000 | Offline cap before the oldest events drop |
logLevel | .silent | .silent .error .warning .info .debug |
transport | URLSessionTransport() | Swap for a fake in tests |
Identity
Notifie.identify("user-42", properties: ["plan": .string("pro")])
// On logout, so the next user does not inherit this anonymous id.
Notifie.reset()Before identify, events carry a generated anonymous id. Identifying links the prior anonymous history to the user. Property values are flat scalars — string, number, boolean, or null.
If the app uses Firebase Authentication, pass FirebaseAuth.currentUser.uid as this external user ID after sign-in. Notifie does not automatically read Firebase Auth and never replaces the application's source of identity.
Events
Notifie.track("checkout_completed", properties: [
"plan": .string("pro"),
"amount": .double(29.0)
])
// Deliver anything queued right now, e.g. before backgrounding.
await Notifie.flush()Events are queued and uploaded in batches, so track never blocks and works offline. flush also waits for any in-flight identify or reset, so properties set immediately before it are included.
Already collected for you
Tracking these names yourself duplicates them: install first_open app_open session_start notification_received notification_opened notification_clicked. Device context such as app version, platform, timezone, locale, and notification_permission is attached as user properties.
Push notifications
One call owns the permission request, APNs registration, token persistence, server registration, receipt attribution, and open attribution. Notifie observes Apple's delegate callbacks and forwards them unchanged to any delegate your app already uses.
switch await Notifie.enableNotifications() {
case .enrolled:
break // permission granted and a token registered
case .denied:
showWhyNotificationsHelp() // iOS will not prompt again
case .noToken(let reason):
log("no APNs token: \(reason)")
case .notInitialised:
assertionFailure("call Notifie.initialize first")
}The result is a Notifie.NotificationEnrolment, deliberately not a Bool. "The user said no" and "this is a simulator" need very different responses, and collapsing them hides bugs. .noToken normally means a simulator or a missing Push Notifications capability. Pass options: to change the requested authorisation from the default alert, badge, and sound.
You do not edit AppDelegate or install a UNUserNotificationCenterDelegate for Notifie. If the app already implements those callbacks, they still run normally. A lower-level registerPushToken overload remains available for cross-platform bridges that already own APNs registration.
Reading a payload
if let url = Notifie.deepLink(from: response.notification.request.content.userInfo) {
router.open(url)
}The SDK extracts the deep link; it never opens it. Navigation stays your decision.