-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edits to intro and installation docs #2125
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,42 +6,46 @@ import { | |
|
||
<ExpansionPanel title="Swift Package Manager Installation"> | ||
|
||
**NOTE**: These instructions are intended for usage on Xcode 11 and higher. Xcode 11 is the first version of Xcode that integrates Swift Package manager and makes it _way_ easier to use than it was at the command line. If you are using older versions of Xcode, we recommend using CocoaPods. | ||
> **Note:** These instructions are for Xcode 11 or later. 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"> | ||
|
||
Go to **File > Swift Packages > Add Package Dependency...** | ||
|
||
![add a dependency](../source/screenshot/spm_packages_add_dependency.png) | ||
<img class="screenshot" src="../source/screenshot/spm_packages_add_dependency.png" alt="Adding an SPM dependency" /> | ||
|
||
</ExpansionPanelListItem> | ||
<ExpansionPanelListItem number="2"> | ||
|
||
Paste the URL to the Apollo iOS repo on GitHub ([https://github.com/apollographql/apollo-ios.git](https://github.com/apollographql/apollo-ios.git)) into the search bar, then hit the **Next** button: | ||
Paste the URL to the Apollo iOS GitHub repo (`https://github.com/apollographql/apollo-ios.git`) into the search bar, then click **Next**: | ||
|
||
![paste in the url](../source/screenshot/spm_paste_url.png) | ||
<img class="screenshot" src="../source/screenshot/spm_paste_url.png" alt="Pasting the Apollo iOS GitHub URL" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't remember if this has been updated for Xcode 13 yet but I'll take a look, the look of where you have to paste it is totally different than 12 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've just updated Xcode myself and plan to run through the tutorial properly, I can probably update this as part of that process |
||
|
||
</ExpansionPanelListItem> | ||
<ExpansionPanelListItem number="3"> | ||
|
||
Select what version you want to use, then hit next. Xcode will automatically suggest the current version `Up to Next Major`, we **strongly** suggest that while the iOS SDK is on a `0.x.x` version scheme, you select `Up To Next Minor` instead, as we will still be releasing breaking changes on minor versions: | ||
Select which version you want to use, then click **Next**. | ||
|
||
![select a version](../source/screenshot/spm_select_version.png) | ||
> Xcode automatically suggests the current version, `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 on a minor version. | ||
|
||
<img class="screenshot" src="../source/screenshot/spm_select_version.png" alt="Selecting an Apollo iOS version" /> | ||
|
||
</ExpansionPanelListItem> | ||
<ExpansionPanelListItem number="4"> | ||
|
||
Select which packages you want to use. If you're just getting started, try selecting just the main `Apollo` library first - you can always come back and add the other packages later if you need them. Then hit finish. | ||
|
||
![select the packages you want to use](../source/screenshot/spm_select_package.png) | ||
Select which packages you want to use, then click **Finish**. | ||
|
||
> 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the thought on making this a separate paragraph? I feel like it flows a little weird to tell people to click finish, then tell them what the recommended libs are. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, tweaked |
||
|
||
<img class="screenshot" src="../source/screenshot/spm_select_package.png" alt="Selecting Apollo iOS packages" /> | ||
|
||
_Note: Do **not** select the `Apollo-Dynamic` target, this is only for use for projects linking to our library dynamically. Most projects will not need to do this._ | ||
> **Note:** Do **not** select the `Apollo-Dynamic` target. This target is only for projects that link to Apollo iOS. Most projects do not need to do this. | ||
|
||
</ExpansionPanelListItem> | ||
<ExpansionPanelListItem number="check"> | ||
You're done! | ||
</ExpansionPanelListItem> | ||
</ExpansionPanelList> | ||
|
||
</ExpansionPanel> | ||
</ExpansionPanel> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,48 @@ | ||
--- | ||
title: Introduction | ||
title: Introduction to Apollo iOS | ||
sidebar_title: Introduction | ||
description: A strongly-typed, caching GraphQL client for iOS, written in Swift | ||
--- | ||
|
||
[Apollo iOS](https://github.com/apollographql/apollo-ios) is a strongly-typed, caching GraphQL client for native iOS apps written in Swift. | ||
import { Button } from '@apollo/space-kit/Button'; | ||
import { Link } from 'gatsby'; | ||
import { colors } from 'gatsby-theme-apollo-core'; | ||
|
||
It allows you to execute queries and mutations against a GraphQL server and returns results as query-specific Swift types. This means you don't have to deal with parsing JSON, or passing around dictionaries and making clients cast values to the right type manually. You also don't have to write model types yourself, because these are generated from the GraphQL definitions your UI uses. | ||
**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. | ||
|
||
As the generated types are query-specific, you're only able to access data you actually specify as part of a query. If you don't ask for a field in a particular query, you won't be able to access the corresponding property on the returned data structure. | ||
<p> | ||
<Button | ||
color={colors.primary} | ||
as={<Link to="/tutorial/tutorial-introduction/" />} | ||
style={{marginRight: 16, marginBottom: 16}} | ||
> | ||
Start the tutorial | ||
</Button> | ||
<Button | ||
as={<Link to="/installation/" />} | ||
> | ||
Installation | ||
</Button> | ||
</p> | ||
|
||
In effect, this means you can now rely on the Swift type checker to make sure errors in data access show up at compile time. With our Xcode integration, you can conveniently work with your UI code and corresponding GraphQL definitions side by side, and it will even validate your query documents, and show errors inline. | ||
## Benefits | ||
|
||
Apollo iOS does more than simply run your queries against a GraphQL server, however. It normalizes query results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run. This means your UI is always internally consistent, and can be kept fully up-to-date with the state on the server with the minimum number of queries required. | ||
### Strong typing with codegen | ||
|
||
This combination of immutable models, one way data flow, and automatic consistency management, leads to a very powerful and elegant programming model that allows you to eliminate common glue code and greatly simplifies app development. | ||
Thanks to strong typing in Apollo iOS, you don't need to deal with parsing JSON responses or passing around dictionaries of values that require manual casting. You also don't need to write model types yourself, because models are generated from the GraphQL operations your UI defines. | ||
|
||
## Getting Started | ||
Because generated types are operation-specific, they include properties _only_ for the GraphQL fields included in their corresponding operation. This means you can rely on the Swift type checker to flag data access errors at compile time. | ||
|
||
We have a [detailed iOS tutorial](./tutorial/tutorial-introduction) walking you through how to build an app called [RocketResever](https://github.com/apollographql/iOSTutorial), which talks to the backend built in the [Fullstack Tutorial](https://www.apollographql.com/docs/tutorial/introduction/). | ||
Apollo's Xcode integration enables you to work with your UI code and corresponding GraphQL definitions side by side. It even validates your query documents, showing errors inline. | ||
|
||
If you have questions or would like to contribute, please join our community at [https://community.apollographql.com/](http://community.apollographql.com/new-topic?category=Help&tags=mobile,client). | ||
### Normalized caching | ||
|
||
## Related platforms | ||
Apollo iOS normalizes operation results to build a client-side cache of your data, which is updated with every operation you execute. This means your UI is always internally consistent, and it can stay up to date with your backend with as few operation as possible. | ||
|
||
[Apollo Android](https://github.com/apollographql/apollo-android) is a GraphQL client for native Android apps written in Java and Kotlin, and offers Kotlin Multi-Platform integration as well. | ||
[Learn more about caching.](./caching/) | ||
|
||
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. | ||
## Related libraries | ||
|
||
## Other resources | ||
[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. | ||
|
||
- [GraphQL.org](http://graphql.org) for an introduction and reference to the GraphQL itself, partially written and maintained by the Apollo team. | ||
- [Our website](http://www.apollographql.com/) to learn about Apollo open-source and commercial tools. | ||
- [Our blog](https://www.apollographql.com/blog/) for long-form articles about GraphQL, feature announcements for Apollo, and guest articles from the community. | ||
- [Our Twitter](https://twitter.com/apollographql) for in-the-moment news. | ||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this is good that we're taking a look at this - Carthage has updated to build frameworks and I think we need to update the command to pass
--use-xcframeworks