urql
. The client itself does not depend on the query-builder, but they work together nicely.
This section shows you how you can use it with the query-builder, but it shouldn’t be hard to use it without it.
FetchExchange
), exchanges further down won’t receive it. Once an exchange produces a result, it sends it upstream in reverse order to other exchanges above, until it reaches the application again.
AuthExchange
comes before FetchExchange
, WebSocketExchange
or any other exchange that transmits the data so that those exchanges receive a request with the header.
getToken
function is not asynchronous, we recommend that you first load the token from storage and store it as a statically available variable.
You can find the full example in thesocialnetwork
example on GitHub.
CacheExchange
because it automatically reexecutes queries that might have outdated results.
debug
level logs.
query
, mutate
or subscribe
method that each accepts a query selection and returns a stream of results. SwiftGraphQL heavily leverages the Combine framework that’s also the backbone of SwiftUI so you should know at least the basics to use the library.
Note that the compile will warn you when you try to use a query in place of a mutation or subscription.