This repository has been archived by the owner on May 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
π¦ Creating payloads
Matthijs Logemann edited this page Apr 13, 2017
·
1 revision
After you have the VaporAPNS instance, we can go ahead and create an notification payload. There are multiple quick ways to create a push notification payload. Let's look at a few of them down below.
The most simple notification just contains a body message:
let payload = Payload(message: "Your push message comes here")
let payload = Payload(title: "Title", body: "Your push message comes here")
You can create a content-available push payload using:
let payload = Payload.contentAvailable
If you want a more advanced way of creating a push payload, you can create the Payload yourself: (This example creates a localized push notification with Jena and Frank as passed arguments)
let payload = Payload()
payload.bodyLocKey = "GAME_PLAY_REQUEST_FORMAT"
payload.bodyLocArgs = [ "Jenna", "Frank" ]
The possibilities are endless!