SwiftGraphQL is a code generator as well as a ligtweight client. That's why it's important that you install both of them.
Make sure Xcode 11+ is installed first. Then, you need to include the client in your iOS/macOS project, and locally generate the code using code generator.
Installing SwiftGraphQL 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
SwiftGraphQL as a dependency, since that includes the client code.
To learn more about Swift Package Manager, check out the official documentation.
Installing Code Generator#
SwiftGraphQL generator comes as a CLI tool and as a library that you may import. You can use Mint, Homebrew and Make to use CLI only, or you may import it as a SPM dependency and use the generator itself.
mint install maticzav/swift-graphql
You can read more about Mint here.
brew tap maticzav/swift-graphql https://github.com/maticzav/swift-graphql.git brew install SwiftGraphQL
git clone https://github.com/maticzav/swift-graphql.git cd swift-graphql make install