-
Notifications
You must be signed in to change notification settings - Fork 435
Add a RouteGuide example and tutorial #598
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
Conversation
Motivation: a30043a (grpc#590) introduced a 'Hello World' example and tutorial to help new gRPC Swift users. A more in-depth tutorial would be useful as a next-step for those users. Modifications: Add a tutorial based on the "route guide" service as per https://grpc.io/docs/tutorials/ Move parts of the `README.md` into separate documenation files in `docs/` Result: - Another gRPC tutorial - Easier to find documenation
MrMage
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.
Great codelab! Are there plans to link to all the docs from one central location?
| } | ||
|
|
||
| extension ClientCall { | ||
| public func waitForCompletion(errorCallback: (GRPCStatus) -> Void = { _ in }) { |
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.
What's the advantage of this method over try wait()?
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.
Oops -- I didn't mean to commit this. I was playing around with ideas because waiting on the GRPCStatus can be a bit of a pain: even though we guarantee that it will never fail (i.e. try! status.wait() should not fail) it's something that users have to trust and is absolutely a code-smell.
Also when the future is completed the user has to switch on the status code to check whether it's .ok or not. So there's actually quite a lot of boilerplate required to check the outcome of the call.
Not sold on any solution yet but I've been thinking that a never-failing future would be helpful (i.e. you would recover or similar into something with no .failure branch), as would futures with a particular error type (i.e. like Result).
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.
Sounds like we should revert this here and file an issue for a better future solution :-)
docs/basic-tutorial.md
Outdated
|
|
||
| - `Routeguide_Point`: the request | ||
| - `StatusOnlyCallContext`: a context which exposes status and trailing metadata | ||
| objects. |
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.
s/objects/promises that you can fulfill/?
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.
They're not EventLoopPromises: "objects that you can update"?
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.
Sorry, my mistake. How about "a context which exposes status and trailing metadata
fields that you can change if needed."?
I spoke to @timburks a little while ago about getting gRPC Swift included on https://grpc.io -- so hopefully there! |
Hmm, how about linking to them from README.md as well? |
Already done in this PR! |

Motivation:
a30043a (#590) introduced a 'Hello World' example and tutorial to help
new gRPC Swift users. A more in-depth tutorial would be useful as a
next-step for those users.
Modifications:
Add a tutorial based on the "route guide" service as per
https://grpc.io/docs/tutorials/
Move parts of the
README.mdinto separate documenation files indocs/Result: