/
Launch Apollo Studio

1. Create your project


In this step, you'll add the Apollo iOS SDK to a new project.

Create a new Xcode project

  1. Open Xcode and go to File > New > Project. The template chooser appears.
  2. Under the set of iOS templates, choose Master-Detail App:

    Select single view app template
  3. Click Next. An options dialog for your app appears.
  4. Name the project RocketReserver. Make sure the language is Swift and the User Interface is Storyboard:

    Options for creating a new project
  5. Click Next. Select a location to save your new project and click Finish.

Xcode creates and opens your new project, which has the following structure:

Initial project structure

Add the Apollo iOS SDK to your project

Next, you'll add a dependency on the apollo-ios repo and Apollo libraries using Swift Package Manager (SPM).

  1. Go to File > Swift Packages > Add Package Dependency. A dialog to specify a package repository appears.
  2. Specify https://github.com/apollographql/apollo-ios.git (don't forget the .git!) as the package repository:

    Choose a repo to add a dependency
  3. Click Next. Xcode checks out the repository and analyzes the library. A package options dialog appears.
  4. Select Up to Next Minor from the Version dropdown (because the Apollo iOS SDK is still a 0.x release, breaking changes can occur between minor versions):

    Select next minor in dropdown
  5. Click Next. A list of packages included in the library appears. For this tutorial, select the main Apollo target and the ApolloWebSocket target:

    Select the first and third targets
  6. Click Finish. SPM fetches your dependencies. When it completes, you can see them in the project navigator:

    Screenshot of installed dependencies

Note: Because SPM has not yet implemented Target-Based Dependency Resolution, you'll see the SQLite dependency even though you didn't select it.

Next, before you can use the SDK, you need to obtain a local copy of your GraphQL schema.

Edit on GitHub