Skip to content

Commit 518f5db

Browse files
Merge pull request #126 from NeedleInAJayStack/doc/async-resolver
Changes documentation examples to async/await
2 parents 6bfaa78 + 6d307f9 commit 518f5db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ when creating your GraphQL schema use [Graphiti](https://github.com/GraphQLSwift
4242
Once a schema has been defined queries may be executed against it using the global `graphql` function:
4343

4444
```swift
45-
let result = try graphql(
45+
let result = try await graphql(
4646
schema: schema,
4747
request: "{ hello }",
4848
eventLoopGroup: eventLoopGroup
49-
).wait()
49+
)
5050
```
5151

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

9696
```swift
97-
let subscriptionResult = try graphqlSubscribe(
97+
let subscriptionResult = try await graphqlSubscribe(
9898
schema: schema,
99-
).wait()
99+
)
100100
// Must downcast from EventStream to concrete type to use in 'for await' loop below
101101
let concurrentStream = subscriptionResult.stream! as! ConcurrentEventStream
102102
for try await result in concurrentStream.stream {

0 commit comments

Comments
 (0)