An abstract push notification client for Feather CMS.
- Topic- and device-token-based push notification delivery
- Silent and normal delivery modes
- Deep-link and rich notification metadata
- Badge, sound, and notification collapsing support
- Provider-neutral client and error APIs
- Swift 6.1+
- Platforms:
- Linux
- macOS 15+
- iOS 18+
- tvOS 18+
- watchOS 11+
- visionOS 2+
Use Swift Package Manager; add the dependency to your Package.swift file:
.package(url: "https://github.com/feather-framework/feather-push", exact: "1.0.0-beta.2"),Then add FeatherPush to your target dependencies:
.product(name: "FeatherPush", package: "feather-push"),API documentation is available at the following link.
PushClient accepts a single delivery target for every notification.
Providers do not all support the same targeting model. For example, FCM
supports subscribable topics, while APNs delivers to device tokens and uses
its topic value to identify the application rather than a group of subscribers.
An implementation that cannot handle a target should throw
PushClientError.unsupportedTarget.
let notification = PushNotification(
title: "New message",
body: "You have a new message.",
data: ["messageID": "123"],
deepLink: "myapp://messages/123",
badge: 1,
sound: .default
)
// Device-token delivery is supported by every PushClient implementation.
func sendDeviceNotification(using client: some PushClient) async throws {
try await client.send(
notification: notification,
to: .deviceToken("device-registration-token")
)
}The same interface can target a provider-managed topic:
func sendTopicNotification(using client: some PushClient) async throws {
try await client.send(
notification: notification,
to: .topic("messages")
)
}Warning
This repository is a work in progress, things can break until it reaches v1.0.0.
The following push client implementations are available for use:
- Build:
swift build - Test:
- local:
make test - using Docker:
make docker-test
- local:
- Format:
make format - Check:
make check
Pull requests are welcome. Please keep changes focused and include tests for new logic.