You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-17Lines changed: 18 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -407,57 +407,58 @@ print(me)
407
407
408
408
## Push notifications
409
409
410
-
Pusher also supports push notifications. Instances of your Swift application can register for push notifications and subscribe to "interests". Your server can then publish to those interests, which will be delivered to your Swift application as push notifications.
410
+
Pusher also supports push notifications. Instances of your Swift application can register for push notifications and subscribe to "interests". Your server can then publish to those interests, which will be delivered to your Swift application as push notifications.
411
411
412
412
You should set up your app for push notifications in your `AppDelegate`. Start off your app in the usual way:
For your Swift app to receive push notifications, it must first register with APNs. You should do this when the application finishes launching. Your app should register for all types of notification, like so:
When your server publishes a notification to the interest "donuts", it will get passed to your app. This happens as a call in your `AppDelegate` which you should listen to:
If at a later point you wish to unsubscribe from an interest, this works in the same way:
455
456
456
457
```swift
457
-
pusher.nativePush().unsubscribe("donuts")
458
+
pusher.nativePusher().unsubscribe("donuts")
458
459
```
459
460
460
-
For a complete example of a working app, see the `Example/` directory in this repository.
461
+
For a complete example of a working app, see the [Example/](https://github.com/pusher/pusher-websocket-swift/tree/master/Example) directory in this repository. Specifically for push notifications code, see the [Example/AppDelegate.swift file](https://github.com/pusher/pusher-websocket-swift/blob/master/Example/AppDelegate.swift).
0 commit comments