SwiftGraphQL Logo


GraphQL client and Code Generator.

Get Started



SwiftGraphQL is a GraphQL client as well as code generator. You may use the client without generating the utility functions, but we encourage you to try the generator. This section outlines how you install either of them.

Make sure you use Xcode 11+.

Installing Client#

To install it using Swift Package Manager, open the following menu item in Xcode:

File > Swift Packages > Add Package Dependency...

In the Choose Package Repository prompt add this url:


Then press Next and complete the remaining steps. You should select all packages as dependencies apart from the SwiftGraphQLCLI and SwiftGraphQLCodegen.

To learn more about Swift Package Manager, check out the official documentation.

Installing Generator#

To generate query building functions, you are going to use SwiftGraphQL generator CLI. Follow the instructions below on how to install the generator using your tool of choice.

To run the generator, type swift-graphql. If you are using any custom scalars, you should create a configuration file called swiftgraphql.yml and put in data-type mappings as a key-value dictionary like this. Keys should be GraphQL types, and values should be SwiftGraphQL Codecs.

# swiftgraphql.yml scalars: Date: DateTime Upload: Upload

You can also run swift-graphql --help to learn more.


brew tap maticzav/swift-graphql https://github.com/maticzav/swift-graphql.git brew install SwiftGraphQL


mint install maticzav/swift-graphql

You can read more about Mint here.


git clone https://github.com/maticzav/swift-graphql.git cd swift-graphql make install