Use this file to discover all available pages before exploring further.
The Courier iOS SDK provides prebuilt UI components and APIs for building notification experiences in Swift. It handles authentication, token management, and real-time message delivery so you can focus on your app.
Inbox — prebuilt notification center with theming and custom rendering
Push Notifications — automatic token syncing and delivery tracking for APNS and FCM
Preferences — prebuilt UI for users to manage their notification settings
All SDK features (Inbox, Push, Preferences) require a signed-in user. Authentication is JWT-based; your backend generates a token and the SDK manages credentials across app sessions.
Pass the JWT to the SDK where you manage user state. Credentials persist across app sessions. If the token expires, generate a new one from your backend and call signIn again; the SDK does not handle token refresh automatically.
Read the current user or listen for sign-in / sign-out events:
Task { let userId = await Courier.shared.userId let isSignedIn = await Courier.shared.isUserSignedIn let listener = await Courier.shared.addAuthenticationListener { userId in print(userId ?? "No user signed in") } listener.remove()}
Inspect the loaded inbox without subscribing to a listener:
Task { let feed = await Courier.shared.feedMessages let archived = await Courier.shared.archivedMessages // Pagination is automatic when scrolling the prebuilt UI; you can also drive it manually: try await Courier.shared.fetchNextInboxPage(.feed) try await Courier.shared.fetchNextInboxPage(.archived) // Pull-to-refresh try await Courier.shared.refreshInbox() // Adjust how many messages are loaded per page (default: 32) await Courier.shared.setPaginationLimit(50)}
Prompt the user to allow notifications. iOS shows a system dialog the first time; if the user denies, they must enable notifications from device Settings.
let status = try await Courier.requestNotificationPermission()
Once you’ve completed the setup above, send a test push using the Send API with push as the routing channel. See the APNS sending guide or FCM sending guide for complete examples.
Pass a CourierPreferencesTheme to customize fonts, colors, toggle styles, and section headers. Light and dark themes are both supported, and Courier Studio branding is automatically applied when a brandId is provided.
For advanced use cases, CourierClient is a low-level wrapper around the Courier API. Each client holds its own credentials, so you can spin up as many as you need.
let client = CourierClient( jwt: "...", // Optional. Required for most authenticated calls clientKey: "...", // Optional. Used only for Inbox client-key auth userId: "your_user_id", connectionId: "...", // Optional. Used for the inbox websocket tenantId: "...", // Optional. Scopes the client to a tenant apiUrls: .eu, // Optional. Use for EU-hosted workspaces showLogs: true // Optional. Defaults to your build configuration)// Inspect or log via the clientlet options = client.optionsclient.log("...")client.warn("...")client.error("...")
let socket = client.inbox.sockettry await socket.connect( receivedMessage: { message in print(message) }, receivedMessageEvent: { event in // Fires only when the event comes from a different connectionId // Available events: .read, .unread, .markAllRead, .opened, .archive print(event) })try await socket.sendSubscribe()await socket.disconnect()