Native iOS SDK for real-time push notifications via pn-protocol. No Firebase dependency.
- Real-time push via pn-protocol
- APNs support for background delivery
- Rich notifications with images and action buttons
- In-app messaging (modal, banner, fullscreen, card)
- Message inbox with persistent storage
- Topic subscription for targeted messaging
- A/B testing support
- User segmentation
- Analytics and delivery tracking
- VoIP push support (optional)
In Xcode: File → Add Package Dependencies → Enter:
https://github.com/Rivium-co/rivium-push-ios-sdk.git
Select version 0.1.0 or later.
pod 'RiviumPushSDK', '~> 0.1.0'import RiviumPush
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let config = RiviumPushConfig(apiKey: "your_api_key_here")
RiviumPush.shared.initialize(config: config)
RiviumPush.shared.delegate = self
// Request notification permission
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, _ in
if granted {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
// Register device
RiviumPush.shared.register(userId: "user_123") // userId is optional
return true
}func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
RiviumPush.shared.setAPNsToken(deviceToken)
}extension AppDelegate: RiviumPushDelegate {
func riviumPush(_ riviumPush: RiviumPush, didRegisterWithDeviceId deviceId: String) {
print("Registered: \(deviceId)")
}
func riviumPush(_ riviumPush: RiviumPush, didReceiveMessage message: RiviumPushMessage) {
print("Message: \(message.title ?? "")")
}
func riviumPush(_ riviumPush: RiviumPush, didTapNotification message: RiviumPushMessage) {
// Handle notification tap
}
func riviumPush(_ riviumPush: RiviumPush, didChangeConnectionState connected: Bool) {
print("Connected: \(connected)")
}
func riviumPush(_ riviumPush: RiviumPush, didFailWithError error: Error) {
print("Error: \(error)")
}
}// Set user ID (after login)
RiviumPush.shared.setUserId("user_123")
// Clear user ID (after logout)
RiviumPush.shared.clearUserId()// Subscribe
RiviumPush.shared.subscribeTopic("news")
// Unsubscribe
RiviumPush.shared.unsubscribeTopic("news")// Trigger messages
RiviumPush.shared.triggerInAppOnAppOpen()
RiviumPush.shared.triggerInAppEvent("viewed_product")
// Set up callback
RiviumPush.shared.setInAppMessageCallback(handler)// Fetch messages
RiviumPush.shared.getInboxMessages(
filter: InboxFilter(limit: 50),
onSuccess: { response in
let messages = response.messages
let unread = response.unreadCount
},
onError: { error in print(error) }
)
// Real-time updates
RiviumPush.shared.setInboxCallback(handler)
// Mark as read
RiviumPush.shared.markInboxMessageAsRead(messageId: "msg_123")
// Get unread count
let count = RiviumPush.shared.getInboxManager().getUnreadCount()let manager = RiviumPush.shared.getABTestingManager()
// Get active tests
manager.getActiveTests { result in
// handle tests
}
// Get variant assignment
manager.getVariant(testId: "test_123") { result in
if case .success(let variant) = result {
print("Assigned to: \(variant.variantName)")
}
}
// Track events
manager.trackEvent(testId: "test_123", variantId: "variant_456", event: .clicked) { _ in }let config = RiviumPushConfig.builder(apiKey: "your_key")
.usePushKit(false) // VoIP push (only for calling apps)
.useAPNs(true) // Standard APNs (recommended)
.showNotificationInForeground(true)
.autoConnect(true)
.autoReconnect(true)
.build()| Option | Default | Description |
|---|---|---|
usePushKit |
false |
Enable VoIP push (calling apps only) |
useAPNs |
true |
Enable standard APNs |
showNotificationInForeground |
false |
Show notifications when app is active |
autoConnect |
true |
Auto-connect when app enters foreground |
autoReconnect |
true |
Auto-reconnect with exponential backoff |
- iOS 13.0+
- Swift 5.7+
- Xcode 14+
The Example/ folder contains a complete demo app with:
- Push notification receiving
- In-app message triggers
- Inbox management
- A/B test variant assignment
- Settings and debugging tools
- Rivium Push - Learn more about Rivium Push
- Documentation - Full documentation and guides
- Rivium Console - Manage your push notifications
MIT License - see LICENSE for details.