Skip to content

APNS 1.0.0 Beta 2.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@tanner0101 tanner0101 released this 09 Dec 22:29

This package provides an easy to use API for sending push notifications to Apple's APNS powered by APNSwift.

Use app.apns to configure your application:

import APNS

try app.apns.configure(.init(
    keyIdentifier: "...",
    teamIdentifier: "...",
    signer: .init(file: ...),
    topic: "codes.vapor.example",
    environment: .sandbox
))

Then use the req.apns to send pushes from a route handler:

app.get("send-push") { req -> EventLoopFuture<HTTPStatus> in
    req.apns.send(
        .init(title: "Hello", subtitle: "This is a test from vapor/apns"),
        to: "..."
    ).map { .ok }
}