Skip to content

Changes documentation examples to async/await #126

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ when creating your GraphQL schema use [Graphiti](https://github.com/GraphQLSwift
Once a schema has been defined queries may be executed against it using the global `graphql` function:

```swift
let result = try graphql(
let result = try await graphql(
schema: schema,
request: "{ hello }",
eventLoopGroup: eventLoopGroup
).wait()
)
```

The result of this query is a `GraphQLResult` that encodes to the following JSON:
Expand Down Expand Up @@ -94,9 +94,9 @@ let schema = try GraphQLSchema(
To execute a subscription use the `graphqlSubscribe` function:

```swift
let subscriptionResult = try graphqlSubscribe(
let subscriptionResult = try await graphqlSubscribe(
schema: schema,
).wait()
)
// Must downcast from EventStream to concrete type to use in 'for await' loop below
let concurrentStream = subscriptionResult.stream! as! ConcurrentEventStream
for try await result in concurrentStream.stream {
Expand Down