Skip to main content

CocoaPods Integration

The Zixflow React Native SDK automatically integrates with the native iOS SDK via CocoaPods or Swift Package Manager. If you’re using React Native 0.60 or higher, dependencies are auto-linked.
  1. Navigate to the iOS directory:
cd ios
  1. Install CocoaPods dependencies:
pod install
  1. Open the workspace in Xcode:
open YourApp.xcworkspace
The SDK will automatically include the necessary Zixflow iOS modules:
  • ZixflowCommon
  • ZixflowDataPipelines
  • ZixflowMessagingPush
  • ZixflowMessagingPushAPN (for APNs)
  • ZixflowMessagingInApp

Swift Package Manager Integration

If you prefer Swift Package Manager (SPM), you can configure your project to use the Zixflow iOS SDK directly:
  1. Open your project in Xcode
  2. Go to File > Add Package Dependencies
  3. Enter the repository URL:
    https://github.com/zixflow/zixflow-ios.git
    
  4. Select the version: Use 1.0.0 or higher
  5. Add the following modules to your app target:
    • Zixflow (umbrella module)
    • ZixflowDataPipelines
    • ZixflowMessagingPushAPN
    • ZixflowMessagingInApp
Note: The example app uses SPM for the native iOS SDK integration. See example/ios/Podfile for reference.

Push Notification Setup (APNs)

To enable Apple Push Notifications (APNs):
  1. Enable Push Notifications capability in Xcode:
    • Select your app target
    • Go to Signing & Capabilities
    • Click + Capability and add Push Notifications
  2. Enable Background Modes:
    • Add Background Modes capability
    • Enable Remote notifications
  3. Configure APNs certificates in your Apple Developer account and upload them to Zixflow dashboard.

Notification Service Extension

To support rich push notifications (images, videos, action buttons), you need to add a Notification Service Extension:
  1. Create a Notification Service Extension in Xcode:
    • File > New > Target > Notification Service Extension
    • Name it NotificationServiceExtension
  2. Add Zixflow modules to the extension in your Podfile:
target 'NotificationServiceExtension' do
  pod "ZixflowMessagingPushAPN", "~> 1.0"
  pod "ZixflowMessagingPush", "~> 1.0"
  pod "ZixflowDataPipelines", "~> 1.0"
  pod "ZixflowCommon", "~> 1.0"
  pod "AnalyticsSwiftZixflow", "1.7.3+zixflow.1"
end
  1. Update NotificationService.swift:
import UserNotifications
import ZixflowMessagingPushAPN

class NotificationService: UNNotificationServiceExtension {
    var contentHandler: ((UNNotificationContent) -> Void)?
    var bestAttemptContent: UNMutableNotificationContent?

    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
        self.contentHandler = contentHandler
        bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)

        // Use Zixflow to handle rich push
        MessagingPushAPN.didReceive(request, withContentHandler: contentHandler)
    }

    override func serviceExtensionTimeWillExpire() {
        if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
            contentHandler(bestAttemptContent)
        }
    }
}
  1. Run pod install again to install extension dependencies.