-
Notifications
You must be signed in to change notification settings - Fork 46
[FTF-283] Add getting started guide for APNs for swift. #3147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7c4bab8 to
9f94a7f
Compare
9f94a7f to
3feba8d
Compare
3feba8d to
b482d42
Compare
b482d42 to
898bda5
Compare
898bda5 to
dcd68ab
Compare
|
|
||
| ### Create a Swift project with Xcode <a id="prerequisites-create-project"/> | ||
|
|
||
| Create a new iOS project with SwiftUI. For detailed instructions, refer to the [Apple Developer documentation](https://developer.apple.com/documentation/swiftui). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much detail do we want here? I think we should probably assume that someone knows how to setup a Swift project, so we perhaps cut this down to just making sure you've got ably-cocoa installed? cc @m-hulbert
| ```swift | ||
| // MARK: - UNUserNotificationCenterDelegate Methods | ||
|
|
||
| /// Handle notification when app is in foreground |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be elaborating on handling background notifications?
| ``` | ||
| </Code> | ||
|
|
||
| To receive messages on the channel as push notifications, you need to subscribe to the push notifications |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to discuss explicitly here that there are two ways of doing push notifications - direct and channel-based. Perhaps covering (very briefly) when you'd use each, and highlighting that for direct you don't need explicit subscriptions?
| ``` | ||
| </Code> | ||
|
|
||
| To test this code, you can send push notifications from the Ably dashboard or using the API (see the next step). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of our other guides lean into the CLI here, so I think we put that first. Lets add CLI installation to the prerequisite of the guide?
| ``` | ||
| </Code> | ||
|
|
||
| You can also send push notifications by publishing a message with a `push` message's `extras` field to a specific channel: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we perhaps need a specific call out in the guide about there being two ways to do push (see above comment)
| `LocationPushService.swift` file in your extension target. | ||
| Use `locationManager(_:didUpdateLocations)` delegate method to handle location updates as needed. | ||
|
|
||
| ## Step 6: Displaying the results <a id="step-6"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should displaying it come earlier in the guide, so that people can see results as they go?
|
|
||
| Continue to explore the documentation with Swift as the selected language: | ||
|
|
||
| * Check our push example: [AblyPushExample](https://github.com/ably/ably-cocoa/tree/main/Examples/AblyPush) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Check our push example: [AblyPushExample](https://github.com/ably/ably-cocoa/tree/main/Examples/AblyPush) | |
| * Check our [push example](https://github.com/ably/ably-cocoa/tree/main/Examples/AblyPush) |
GregHolmes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than Andy's comments, and my 1 below. I've also got this recommendation, that we update the Step headings to be inline with the other guides:
Step 1: Set up Ably
Step 2: Set up push notifications
Step 3: Receive push notifications
Step 4: Send push notifications
Step 5: Enable location pushes
Step 6: Display the results
|
|
||
| ## Step 6: Displaying the results <a id="step-6"/> | ||
|
|
||
| Now, lets complete our `ContentView` to display all the results of everything we added above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Now, lets complete our `ContentView` to display all the results of everything we added above. | |
| Now, let's complete our `ContentView` to display all the results of everything we added above. |
Description
Checklist