iOS SDK
Swift package with zero third-party dependencies (URLSession + UserNotifications). Handles device registration, open & delivery tracking, deep links and rich notifications. Requires iOS 13+. Source on GitHub ↗
Install
Xcode → File → Add Package Dependencies…
https://github.com/notibolt/notibolt-ios
Or in Package.swift:
.package(url: "https://github.com/notibolt/notibolt-ios", from: "0.1.0")
Add the Push Notifications capability to your target (Signing & Capabilities).
Initialize
import Notibolt
import UserNotifications
@main
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Notibolt.initialize(appId: "YOUR_APP_ID")
UNUserNotificationCenter.current().delegate = self
Notibolt.registerForPushNotifications()
return true
}
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Notibolt.didRegisterForRemoteNotifications(deviceToken: deviceToken)
}
func application(_ application: UIApplication,
didFailToRegisterForRemoteNotificationsWithError error: Error) {
Notibolt.didFailToRegisterForRemoteNotifications(error: error)
}
// Tap → open tracking + deep link
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
Notibolt.handleNotificationResponse(response)
completionHandler()
}
// Show notifications while the app is open
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler:
@escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler(Notibolt.foregroundPresentationOptions)
}
}Users & tags
Notibolt.setExternalUserId("user-42") // after login
Notibolt.removeExternalUserId() // after logout
Notibolt.setTags(["plan": "pro"]) // audience tags (replaces existing)
Notibolt.setNotificationsEnabled(false) // in-app opt-out
Notibolt.deviceId // Notibolt device idTarget them from the API with "segment": { "externalUserIds": ["user-42"] } or "segment": { "tags": { "plan": "pro" } }.
Rich notifications & confirmed delivery
Add a Notification Service Extension target, add the Notibolt package to it, and subclass:
import Notibolt
class NotificationService: NotiboltNotificationServiceExtension {}This one line gives you:
- Images —
imageUrlis downloaded and attached to the notification. - Confirmed delivery — “reached the device” is reported back, powering the Delivered stat.
No App Groups needed — the payload carries everything the extension requires. Self-hosting? Add a
NotiboltApiUrl key to the extension's Info.plist.Foreground behavior
Notibolt.foregroundPresentationOptions = [.sound] // default: banner + sound + badge
Payload reference
| userInfo key | Meaning |
|---|---|
notibolt_notification_id | Notification id (tracking) |
notibolt_device_id | This device's id |
notibolt_url | Deep link, if provided |
notibolt_image | Image URL, if provided |
| your keys | Anything passed in data |
Tips
- Simulators: on Apple Silicon Macs, iOS simulators receive real APNs sandbox pushes — enable Use APNs sandbox in your app settings.
- Self-hosted / local dev:
Notibolt.initialize(appId: "…", apiUrl: "http://localhost:3001/api/v1") - The SDK refreshes
lastActiveAtand permission status every time the app becomes active.