Swiftpack.co - vapor/apns as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by vapor.
vapor/apns 4.0.0-alpha.2
Helpful extensions and abstractions for using APNSwift
⭐️ 73
🕓 1 week ago
iOS macOS
.package(url: "https://github.com/vapor/apns.git", from: "4.0.0-alpha.2")

APNS

Helpful extensions and abstractions for using APNSwift

GitHub

link
Stars: 73
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

4.0.0-alpha.2
1 week ago

What's Changed

This is a breaking change and requires new configuration when starting up vapor.

let authenticationConfig: APNSConfiguration.Authentication = .init(
    privateKey: try .loadFrom(string: appleECP8PrivateKey),
    teamIdentifier: "ABBM6U9RM5",
    keyIdentifier: "9UC9ZLQ8YW"
)

let apnsConfig: APNSConfiguration = .init(
    authenticationConfig: authenticationConfig,
    topic: "MY_TOPIC",
    environment: .sandbox,
    eventLoopGroupProvider: .shared(app.eventLoopGroup),
    logger: app.logger
)
app.apns.containers.use(apnsConfig, as: .default)

if you're loading your p8 file from disk, use loadFrom(filePath:)

let authenticationConfig: APNSConfiguration.Authentication = .init(
        privateKey: try .loadFrom(filePath: "/Users/kylebrowning/Documents/AuthKey_9UC9ZLQ8YW.p8"),
        teamIdentifier: "ABBM6U9RM5",
        keyIdentifier: "9UC9ZLQ8YW"
    )

You can also choose to send sandbox/prod environment on the notification send function

try await apns.client.send(aps, to: deviceToken, on: .sandbox)

Full Changelog: https://github.com/vapor/apns/compare/3.0.0...4.0.0-alpha.2

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics