diff --git a/docs/source/installation.mdx b/docs/source/installation.mdx index b272b70305..b948d66b92 100644 --- a/docs/source/installation.mdx +++ b/docs/source/installation.mdx @@ -41,7 +41,7 @@ Here's an example file structure: | - your_project_folder | your_project.xcodeproj | - your_target_folder - | schema.json + | schema.json or schema.graphqls | AppDelegate.swift | ViewController.swift | etc... diff --git a/docs/source/swift-scripting.md b/docs/source/swift-scripting.md index 41bdf554d8..306c3155d8 100644 --- a/docs/source/swift-scripting.md +++ b/docs/source/swift-scripting.md @@ -48,22 +48,22 @@ When you unzip the downloaded repo, you'll see that there's a folder called **`A If you're using the default target structure for an Xcode project, your project's file structure will look essentially like this in Finder: ```txt:title=Sample%20Project%20Structure -📂 MyProject // Source root - ┃ 📄 MyProject.xcodeproj - ┣ 📁 MyProject // Contains app target source files - ┣ 📁 MyLibraryTarget // Contains lib target source files - ┣ 📁 MyProjectTests // Contains test files +MyProject // Source root +├─ MyProject.xcodeproj +├─ MyProject/ // Contains app target source files +├─ MyLibraryTarget/ // Contains lib target source files +├─ MyProjectTests/ // Contains test files ``` Drag the `ApolloCodegen` folder in **at the same level as your other targets** (in Finder, not in Xcode): ```txt:title=Sample%20Project%20Structure -📂 MyProject // Source root - ┃ 📄 MyProject.xcodeproj - ┣ 📁 MyProject // Contains app target source files - ┣ 📁 MyLibraryTarget // Contains lib target source files - ┣ 📁 MyProjectTests // Contains test files - ┣ 📁 ApolloCodegen // Contains the swift scripting files you just downloaded and dragged in +MyProject // Source root +├─ MyProject.xcodeproj +├─ MyProject/ // Contains app target source files +├─ MyLibraryTarget/ // Contains lib target source files +├─ MyProjectTests/ // Contains test files +├─ ApolloCodegen/ // Contains the swift scripting files you just downloaded and dragged in ``` Double-click `Package.swift` in the `ApolloCodegen` folder to open the executable's package in Xcode. @@ -140,13 +140,13 @@ swift run ApolloCodegen downloadSchema If you're using the template code and following the sample project structure, the schema should download here: ```txt:title=Sample%20Project%20Structure -📂 MyProject // SourceRoot - ┃ 📄 MyProject.xcodeproj - ┣ 📂 MyProject // Contains app target source files - ┃ ┃ 📄 schema.json // <-- downloaded schema - ┣ 📁 MyLibraryTarget // Contains lib target source files - ┣ 📁 MyProjectTests // Contains test files - ┣ 📁 ApolloCodegen // Contains Swift Scripting files +MyProject // SourceRoot +├─ MyProject.xcodeproj +├─ MyProject/ // Contains app target source files +│ └─ schema.graphqls +├─ MyLibraryTarget/ // Contains lib target source files +├─ MyProjectTests/ // Contains test files +├─ ApolloCodegen/ // Contains Swift Scripting files ``` Next, now that you have a schema, you need a GraphQL file with an operation in order to generate code. @@ -155,17 +155,17 @@ Next, now that you have a schema, you need a GraphQL file with an operation in o If you're not familiar with creating an operation in graphQL, please check out the [portion of our tutorial on executing your first query](https://www.apollographql.com/docs/ios/tutorial/tutorial-execute-query/). You can stop after the section about adding your query to Xcode. -Make sure you've added the operation file to the project files, ideally at or above the level of the `schema.json` (Otherwise, you'll need to manually pass the URL of your GraphQL files to your code generation step): +Make sure you've added the operation file to the project files, ideally at or above the level of the `schema.graphqls` (Otherwise, you'll need to manually pass the URL of your operation file to your code generation step): ```txt:title=Sample%20Project%20Structure -📂 MyProject // SourceRoot - ┃ 📄 MyProject.xcodeproj - ┣ 📂 MyProject // Contains app target source files - ┃ ┃ 📄 schema.json - ┃ ┃ 📄 LaunchList.graphql - ┣ 📁 MyLibraryTarget // Contains lib target source files - ┣ 📁 MyProjectTests // Contains test files - ┣ 📁 ApolloCodegen // Contains Swift Scripting files +MyProject // SourceRoot +├─ MyProject.xcodeproj +├─ MyProject/ // Contains app target source files +│ ├─ schema.graphqls +│ └─ LaunchList.graphql +├─ MyLibraryTarget/ // Contains lib target source files +├─ MyProjectTests/ // Contains test files +├─ ApolloCodegen/ // Contains Swift Scripting files ``` Here, for example, is what this looks like in a file for one of the queries in our [tutorial application](./tutorial/tutorial-introduction): diff --git a/docs/source/tutorial/images/drag_schema_into_xcode.png b/docs/source/tutorial/images/drag_schema_into_xcode.png deleted file mode 100644 index 570b095df0..0000000000 Binary files a/docs/source/tutorial/images/drag_schema_into_xcode.png and /dev/null differ diff --git a/docs/source/tutorial/tutorial-execute-query.md b/docs/source/tutorial/tutorial-execute-query.md index 1cc198e02f..74da07a5ae 100644 --- a/docs/source/tutorial/tutorial-execute-query.md +++ b/docs/source/tutorial/tutorial-execute-query.md @@ -91,7 +91,7 @@ Now that your query is fetching the right data, head back to Xcode. Empty file template -2. Click **Next** and name the file `LaunchList.graphql`. Make sure it's saved at the same level as your `schema.json` file. As previously, don't add it to any target. +2. Click **Next** and name the file `LaunchList.graphql`. Make sure it's saved at the same level as your `schema.graphqls` file. As previously, don't add it to any target. 3. Copy your final operation from Sandbox Explorer by selecting the three dot (aka "meatball") menu to the right of your operation name and selecting "Copy Operation": @@ -107,7 +107,7 @@ You're now ready to generate code from the combination of your saved query and s 2. _Uncomment_ the line you previously commented out (that includes `codegen:generate`). -3. Build your project. When the build completes, an `API.swift` file appears in the same folder as `schema.json`. +3. Build your project. When the build completes, an `API.swift` file appears in the same folder as `schema.graphqls`. 4. Drag the `API.swift` file into Xcode. This time, **do** check the **Add to target** box for the `RocketReserver` app. You include this file in your application's bundle to enable you to execute the query you defined. diff --git a/docs/source/tutorial/tutorial-obtain-schema.md b/docs/source/tutorial/tutorial-obtain-schema.md index db5a4c1377..4c3c5beb49 100644 --- a/docs/source/tutorial/tutorial-obtain-schema.md +++ b/docs/source/tutorial/tutorial-obtain-schema.md @@ -46,7 +46,7 @@ To use the Apollo CLI from Xcode, add a **Run Script** build phase to your app: UI for renaming -6. Expand the Apollo phase. Paste the **Swift Package Manager Run Script** from [Add a code generation build step](/installation/#5-add-a-code-generation-build-step) into the text area. This script uses your schema to generate the code that the Apollo iOS SDK uses to interact with your server. +6. Expand the Apollo phase. Paste the **Swift Package Manager Run Script** from [Add a code generation build step](../installation/#5-add-a-code-generation-build-step) into the text area. This script uses your schema to generate the code that the Apollo iOS SDK uses to interact with your server. 7. Before the script can generate code, it needs a local copy of your GraphQL server's schema. For now, using a `#`, **comment out the last line** of the script you pasted and add the following line below it: @@ -54,13 +54,9 @@ To use the Apollo CLI from Xcode, add a **Run Script** build phase to your app: "${SCRIPT_PATH}"/run-bundled-codegen.sh schema:download --endpoint="https://apollo-fullstack-tutorial.herokuapp.com/graphql" ``` - This line runs the Apollo CLI's `schema:download` command, which downloads the schema to a `schema.json` file at the same level of your project as the `AppDelegate.swift` file. + This line runs the Apollo CLI's `schema:download` command, which downloads the schema to a `schema.graphqls` file at the same level of your project as the `AppDelegate.swift` file. -8. Build your project to execute the script. In Finder, navigate to the folder that contains your `AppDelegate.swift` file. The folder should now include the downloaded `schema.json` file. Drag this file from Finder into Xcode: - - Where to drag the schema file - - When Xcode offers to add the schema file, make sure **all targets are unchecked** to reduce the size of your application bundle: +8. Build your project to execute the script. In Finder, navigate to the folder that contains your `AppDelegate.swift` file. The folder should now include the downloaded `schema.graphqls` file. Drag this file from Finder into Xcode. When Xcode offers to add the schema file, make sure **all targets are unchecked** to reduce the size of your application bundle: All targets unchecked in dialog