Skip to content
Preview: the PushFleet API isn't live yet. Join the waitlist

Swift

The Swift SDK registers devices from your app with your publishable key. Sending happens from your server.

Add the package in Xcode (File → Add Package Dependencies) or to Package.swift:

.package(url: "https://github.com/pushfleet/pushfleet-swift", from: "0.1.0")

Configure PushFleet at launch, then register from application(_:didRegisterForRemoteNotificationsWithDeviceToken:) once Apple hands you a token.

PushFleet.configure(publishableKey: "pf_pub_test_…")
PushFleet.register(deviceToken: token, userId: "user_8f3k")

Calling register on every launch is safe: the same token updates instead of duplicating.

In live mode, pass a user token your server signed for the signed-in user. See identity verification.

PushFleet.register(deviceToken: token, userId: "user_8f3k", userToken: userToken)