> ## Documentation Index
> Fetch the complete documentation index at: https://swift-graphql.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

## Installation

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:

```
https://github.com/maticzav/swift-graphql/
```

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](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).

### 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.

```yml theme={null}
# swiftgraphql.yml
scalars:
  Date: DateTime
  Upload: Upload
```

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

#### Homebrew

```sh theme={null}
brew tap maticzav/swift-graphql https://github.com/maticzav/swift-graphql.git
brew install SwiftGraphQL
```

#### Mint

```sh theme={null}
mint install maticzav/swift-graphql
```

> You can read more about Mint [here](https://github.com/yonaskolb/mint).

#### Make

```sh theme={null}
git clone https://github.com/maticzav/swift-graphql.git
cd swift-graphql
make install
```
