Skip to content

Commit

Permalink
Updates for new docs infra (#2197)
Browse files Browse the repository at this point in the history
* Prepare ios docs for new infra

* Add sidebar config

* Update ExpansionPanelList components

* Update code fences

* Move _redirects file

* Fix links

* Update docset title

* Update sidebar config

* Add version to ios docs config

* Remove imports and fix links

* Remove mb from homepage button

* Add algolia filters
  • Loading branch information
trevorblades authored Mar 15, 2022
1 parent 52bbeac commit 6aee64a
Show file tree
Hide file tree
Showing 28 changed files with 162 additions and 181 deletions.
28 changes: 12 additions & 16 deletions docs/shared/carthage-installation-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="Carthage Installation">

<ExpansionPanelList>
<ExpansionPanelListItem number="1">
<ExpansionPanelListItem>

<h4>Set up your `Cartfile`</h4>
#### Set up your `Cartfile`

Add `github "apollographql/apollo-ios"` to your Cartfile.

</ExpansionPanelListItem>
<ExpansionPanelListItem number="2">
<ExpansionPanelListItem>

<h4>Check out and build dependencies</h4>
#### Check out and build dependencies

Run `carthage update --use-xcframeworks --platform ios` (or `--platform ios,macos` to build both Mac and iOS).

> **Note:** There's an issue with the way Carthage uses Lipo in the Xcode 12 GM. Please `cd` into `[YourProject]/Carthage/Checkouts/apollo-ios/scripts` and then run `./carthage-build-workaround.sh` to resolve this build issue.
</ExpansionPanelListItem>
<ExpansionPanelListItem number="3">
<ExpansionPanelListItem>

<h4>Add built frameworks to your project</h4>
#### Add built frameworks to your project

Drag and drop `Apollo.framework` from the appropriate `Carthage/Build/iOS` or `Carthage/Build/Mac` folder to the **Embedded Binaries** section of your application target's **General** settings tab. This should also cause them to appear in the **Linked Frameworks And Libraries** section automatically.
- To include the `ApolloSQLite` library, also drag `ApolloSQLite.framework` and `SQLite.framework` to this area.
- To include the `ApolloWebSocket` library, also drag `ApolloWebSocket.framework` and `Starscream.framework` to this area.

</ExpansionPanelListItem>
<ExpansionPanelListItem number="4">
<ExpansionPanelListItem>

<h4>Work around Carthage submission bug</h4>
#### Work around Carthage submission bug

On your application target's **Build Phases** settings tab, click the **+** icon and choose **New Run Script Phase**. Create a Run Script in which you specify your shell (e.g., `bin/sh`) and add the following contents to the script area below the shell:

Expand All @@ -53,8 +47,10 @@ Again, if you're adding `ApolloSQLite` or `ApolloWebSocket`, please make sure to
This script works around an [App Store submission bug](http://www.openradar.me/radar?id=6409498411401216) triggered by universal binaries and ensures that necessary bitcode-related files and dSYMs are copied when archiving.
</ExpansionPanelListItem>
<ExpansionPanelListItem number="check">
You're done!
<ExpansionPanelListItem>
You're done!

</ExpansionPanelListItem>
</ExpansionPanelList>

Expand Down
6 changes: 0 additions & 6 deletions docs/shared/carthage-run-script-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="Carthage Run Script">

The scripts and binaries that you need to generate code are included in the `Carthage/Checkouts` folder. If this folder is not checked into version control, all developers on a team (and your CI machine) need to run `carthage checkout` when changes are made to the version to ensure they have the correct underlying binaries and scripts.
Expand Down
24 changes: 10 additions & 14 deletions docs/shared/pods-installation-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="CocoaPods Installation">

<ExpansionPanelList>
<ExpansionPanelListItem number="1">
<ExpansionPanelListItem>

<h4>Install or update CocoaPods</h4>
#### Install or update CocoaPods

Because Apollo iOS uses Swift 5, you need to use CocoaPods version `1.7.0` or later. You can install CocoaPods with the following command:

Expand All @@ -18,28 +12,30 @@ Because Apollo iOS uses Swift 5, you need to use CocoaPods version `1.7.0` or la
```

</ExpansionPanelListItem>
<ExpansionPanelListItem number="2">
<ExpansionPanelListItem>

<h4>Add dependencies</h4>
#### Add dependencies

Add `pod "Apollo"` to your Podfile.

- To include the `ApolloSQLite` framework, also add `pod "Apollo/SQLite"`
- To include the `ApolloWebSocket` framework, also add `pod "Apollo/WebSocket"`

</ExpansionPanelListItem>
<ExpansionPanelListItem number="3">
<ExpansionPanelListItem>

Run `pod install`.

</ExpansionPanelListItem>
<ExpansionPanelListItem number="4">
<ExpansionPanelListItem>

Use the `.xcworkspace` file generated by CocoaPods to work on your project.

</ExpansionPanelListItem>
<ExpansionPanelListItem number="check">
You're done!
<ExpansionPanelListItem>

You're done!
</ExpansionPanelListItem>
</ExpansionPanelList>
Expand Down
6 changes: 0 additions & 6 deletions docs/shared/pods-run-script-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="CocoaPods Run Script">

Our CocoaPods install includes the code-generation scripts and binaries of the `apollo` CLI client as files which will not be added to the framework, but which you can still call from a Run Script Build Phase. Add the following to the Run Script:
Expand Down
20 changes: 8 additions & 12 deletions docs/shared/spm-installation-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="Swift Package Manager Installation">

> **Note:** These instructions use the Xcode 13 UI. Xcode 11 is the first version of Xcode that integrates Swift Package manager, whereas older versions require using the command line. If you're using an older version of Xcode, we recommend using CocoaPods instead.
<ExpansionPanelList>
<ExpansionPanelListItem number="1">
<ExpansionPanelListItem>

Go to **File > Add Packages...**

<img class="screenshot" src="../source/screenshot/spm_packages_add_package.jpg" alt="Adding an SPM package" width="300" />

</ExpansionPanelListItem>
<ExpansionPanelListItem number="2">
<ExpansionPanelListItem>

In the dialog that appears, paste the URL of the Apollo iOS GitHub repo (`https://github.com/apollographql/apollo-ios.git`) into the search bar, then select the `apollo-ios` package that appears:

<img class="screenshot" src="../source/screenshot/spm_packages_dialog.jpg" alt="Pasting the Apollo iOS GitHub URL" />

</ExpansionPanelListItem>
<ExpansionPanelListItem number="3">
<ExpansionPanelListItem>

Select which version you want to use ([see version history](https://github.com/apollographql/apollo-ios/releases)), then click **Add Package**. Note that Xcode might not automatically select the latest version number!

> Xcode automatically suggests the dependency rule `Up to Next Major`. We **strongly** suggest that until the release of Apollo iOS `1.x`, you select `Up To Next Minor` instead, because we might release breaking changes in a minor version.
</ExpansionPanelListItem>
<ExpansionPanelListItem number="4">
<ExpansionPanelListItem>

Select which packages you want to use. If you're getting started, we recommend selecting just the main `Apollo` library for now. You can always add other packages later if you need them.

Expand All @@ -41,8 +35,10 @@ Select which packages you want to use. If you're getting started, we recommend s
Then, click **Add Package**.

</ExpansionPanelListItem>
<ExpansionPanelListItem number="check">
You're done!
<ExpansionPanelListItem>

You're done!

</ExpansionPanelListItem>
</ExpansionPanelList>

Expand Down
6 changes: 0 additions & 6 deletions docs/shared/spm-run-script-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="Swift Package Manager Run Script">

> **Note:** If your Derived Data is in a custom location, go back and use the [Swift Scripting](./swift-scripting) method instead. This script relies on Derived Data being in the default location. Swift Scripting doesn't rely on Derived Data at all.
Expand Down
6 changes: 0 additions & 6 deletions docs/shared/sqlite-carthage-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="Adding SQLite with Carthage">

You will need to add the `ApolloSQLite` framework to your target. This should be one of the libraries that gets built automatically on checkout, and should include the dependent libraries necessary to run it.
Expand Down
6 changes: 0 additions & 6 deletions docs/shared/sqlite-cocoapods-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="Adding SQLite with CocoaPods">

Add the following to your `Podfile`:
Expand Down
6 changes: 0 additions & 6 deletions docs/shared/sqlite-spm-panel.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
ExpansionPanel,
ExpansionPanelList,
ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="Adding SQLite with Swift Package Manager">

Add the following to your `Package.swift`:
Expand Down
1 change: 0 additions & 1 deletion docs/static/_redirects → docs/source/_redirects
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/tutorial /docs/ios/tutorial/tutorial-introduction
/tutorial/tutorial-create-project /docs/ios/tutorial/tutorial-add-sdk
/docs/ios/tutorial/tutorial-create-project /docs/ios/tutorial/tutorial-add-sdk
13 changes: 6 additions & 7 deletions docs/source/api-reference.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
title: API Reference
description: ''
---

* [Apollo.framework](../api/Apollo/README/)
* [ApolloAPI.framework](../api/ApolloAPI/README/)
* [ApolloUtils.framework](../api/ApolloUtils/README/)
* [ApolloCodegenLib.framework](../api/ApolloCodegenLib/README/)
* [ApolloSQLite.framework](../api/ApolloSQLite/README/)
* [ApolloWebSocket.framework](../api/ApolloWebSocket/README/)
* [Apollo.framework](./api/Apollo/README/)
* [ApolloAPI.framework](./api/ApolloAPI/README/)
* [ApolloUtils.framework](./api/ApolloUtils/README/)
* [ApolloCodegenLib.framework](./api/ApolloCodegenLib/README/)
* [ApolloSQLite.framework](./api/ApolloSQLite/README/)
* [ApolloWebSocket.framework](./api/ApolloWebSocket/README/)

Our API reference is automatically generated directly from the inline comments in our code, so if you're adding something new, all you have to do is actually add doc comments and they'll show up here.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This type of cache is used by default when setting up an `ApolloClient`. If you

If for some reason you find you need to instantiate the in-memory cache yourself, you can do so with one line:

```swift:title=Cache%20Setup
```swift title="Cache Setup"
import Apollo

let cache = InMemoryNormalizedCache()
Expand All @@ -52,7 +52,7 @@ Once added, you can do the following:
3. Use that SQLite cache to instantiate an `ApolloStore`.
4. Pass that `ApolloStore` into the initializer of `ApolloClient`:

```swift:title=Client%20Setup
```swift title="Client Setup"
import Apollo

// NOTE: You need this import line if you are **NOT** using CocoaPods. In CocoaPods,
Expand Down
35 changes: 35 additions & 0 deletions docs/source/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Client (iOS)",
"version": "0.X",
"algoliaFilters": [
"docset:ios"
],
"sidebar": {
"Introduction": "/",
"Installation": "/installation",
"API Reference": "/api-reference",
"Tutorial": {
"0. Introduction": "/tutorial/tutorial-introduction",
"1. Add the Apollo SDK": "/tutorial/tutorial-add-sdk",
"2. Obtain your GraphQL schema": "/tutorial/tutorial-obtain-schema",
"3. Execute your first query": "/tutorial/tutorial-execute-query",
"4. Connect your queries to your UI": "/tutorial/tutorial-query-ui",
"5. Paginate results": "/tutorial/tutorial-pagination",
"6. Complete the detail view": "/tutorial/tutorial-detail-view",
"7. Enable authentication": "/tutorial/tutorial-authentication",
"8. Define additional mutations": "/tutorial/tutorial-mutations",
"9. Write your first subscription": "/tutorial/tutorial-subscriptions"
},
"Usage": {
"Downloading a schema": "/downloading-schema",
"Creating a client": "/initialization",
"Fetching queries": "/fetching-queries",
"Performing mutations": "/mutations",
"Using fragments": "/fragments",
"Client-side caching": "/caching",
"Subscriptions": "/subscriptions",
"Swift scripting": "/swift-scripting",
"Request pipeline (advanced)": "/request-pipeline"
}
}
}
2 changes: 1 addition & 1 deletion docs/source/downloading-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You can use the [Apollo CLI](https://www.apollographql.com/docs/devtools/cli/) t
apollo schema:download --endpoint=http://localhost:8080/graphql schema.json
```

Note that if you're using the local version set up for codegen, you should use the same method you're using in the [Add a code generation build step](/installation/#5-add-a-code-generation-build-step) instructions to access that specific CLI. For example, if you're using CocoaPods, you can set it up like this to download your schema:
Note that if you're using the local version set up for codegen, you should use the same method you're using in the [Add a code generation build step](./installation/#5-add-a-code-generation-build-step) instructions to access that specific CLI. For example, if you're using CocoaPods, you can set it up like this to download your schema:

```bash
SCRIPT_PATH="${PODS_ROOT}/Apollo/scripts"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/fetching-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Again, make sure to define this in a file that is outside of your generated code

## Specifying a cache policy

[This section has moved to the Caching documentation](/caching/).
[This section has moved to the Caching documentation](./caching/).

## Using `GET` instead of `POST` for queries

Expand Down
16 changes: 8 additions & 8 deletions docs/source/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ sidebar_title: Introduction
description: A strongly-typed, caching GraphQL client for iOS, written in Swift
---

import { Button } from '@apollo/space-kit/Button';
import { Link } from 'gatsby';
import { colors } from 'gatsby-theme-apollo-core';

**Apollo iOS** is an [open-source](https://github.com/apollographql/apollo-ios) GraphQL client for native iOS apps, written in Swift. It enables you to execute queries and mutations against a GraphQL server and returns results as operation-specific Swift types.

<p>
<Button
color={colors.primary}
as={<Link to="/tutorial/tutorial-introduction/" />}
style={{marginRight: 16, marginBottom: 16}}
colorScheme="indigo"
as={Link}
to="./tutorial/tutorial-introduction/"
mr="4"
>
Start the tutorial
</Button>
<Button
as={<Link to="/installation/" />}
as={Link}
to="./installation/"
>
Installation
</Button>
Expand All @@ -43,6 +43,6 @@ Apollo iOS normalizes operation results to build a client-side cache of your dat

## Related libraries

[Apollo Kotlin](https://www.apollographql.com/docs/kotlin/) is a GraphQL client for native Android apps written in Java and Kotlin. It offers Kotlin Multi-Platform integration as well.
[Apollo Kotlin](/kotlin/) is a GraphQL client for native Android apps written in Java and Kotlin. It offers Kotlin Multi-Platform integration as well.

Apollo Client for JavaScript's [React integration](https://apollographql.com/docs/react) works with [React Native](https://facebook.github.io/react-native/) on both iOS and Android.
Apollo Client for JavaScript's [React integration](/react) works with [React Native](https://facebook.github.io/react-native/) on both iOS and Android.
4 changes: 2 additions & 2 deletions docs/source/initialization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ Apollo iOS provides the following classes that conform to the [`NetworkTransport
| `WebSocketTransport` | Transmits _all_ GraphQL operations via WebSocket. Requires the `Apollo/WebSocket` sub-spec. |
| `SplitNetworkTransport` | Transmits subscription operations via WebSocket and other operations via HTTP. Requires the `Apollo/WebSocket` sub-spec. |

> * For more information on `RequestChainNetworkTransport`, see [Request pipeline in Apollo iOS](/request-pipeline/).
> * For more information on `WebSocketTransport` and `SplitNetworkTransport`, see [Subscriptions](/subscriptions/).
> * For more information on `RequestChainNetworkTransport`, see [Request pipeline in Apollo iOS](./request-pipeline/).
> * For more information on `WebSocketTransport` and `SplitNetworkTransport`, see [Subscriptions](./subscriptions/).
4 changes: 2 additions & 2 deletions docs/source/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ You can install `Apollo.framework` into your project using any of the three majo

## 3. Add a schema file to your target directory

For Apollo iOS to generate models for your GraphQL operations, you need a local copy of your GraphQL server's schema. To acquire this schema, see [Downloading a schema](/downloading-schema/).
For Apollo iOS to generate models for your GraphQL operations, you need a local copy of your GraphQL server's schema. To acquire this schema, see [Downloading a schema](./downloading-schema/).

Make sure to add your `schema.json`/`schema.graphqls` file to the folder where most of your code is, _not_ to the folder where your `.xcodeproj` and/or `.xcworkspace` files are located.

Expand Down Expand Up @@ -115,7 +115,7 @@ Drag the generated `API.swift` file to your target.
Make sure to uncheck the "Copy Files If Needed" checkbox, because it should already be in your project's folder system. Then, make sure you've checked all the Targets the API file needs to be included in.

**Installation complete!** You can now start executing GraphQL operations in your app. To learn how, next check out [Creating a client](/initialization/) and [Fetching queries](/fetching-queries/).
**Installation complete!** You can now start executing GraphQL operations in your app. To learn how, next check out [Creating a client](./initialization/) and [Fetching queries](./fetching-queries/).

You can also continue reading below for some [advanced codegen tips](#advanced-codegen-tips-and-tricks).

Expand Down
Loading

0 comments on commit 6aee64a

Please sign in to comment.