Skip to content

Commit 3bb76ac

Browse files
committed
Rename target with generated code
1 parent fa77e9c commit 3bb76ac

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Install or add following line to your dependencies:
2020

2121
**Make sure that `GraphQLAPIKit` is added as a package dependency to your project**
2222

23-
#### 1. Create `GraphQLAPI` folder at your `ProjectName.xcodeproj` level
23+
#### 1. Create `GraphQLGenerated` folder at your `ProjectName.xcodeproj` level
2424

2525
#### 2. Add Apollo configuration file
2626

27-
Add `apollo-codegen-config.json` file and add it to `GraphQLAPI` folder.
27+
Add `apollo-codegen-config.json` file and add it to `GraphQLGenerated` folder.
2828
Copy and paste json configuration to the newly created file:
2929
```json
3030
{
31-
"schemaName" : "GraphQLAPI",
31+
"schemaName" : "GraphQLGenerated",
3232
"input" : {
3333
"operationSearchPaths" : [
3434
"**/*.graphql"
@@ -49,17 +49,17 @@ Copy and paste json configuration to the newly created file:
4949
},
5050
"testMocks" : {
5151
"swiftPackage": {
52-
"targetName": "GraphQLAPIMocks"
52+
"targetName": "GraphQLGeneratedMocks"
5353
}
5454
}
5555
}
5656
}
5757
```
5858
#### 3. Add schema file
59-
Add GraphQL JSON schema to the `GraphQLAPI` folder and name it `schema.json`.
59+
Add GraphQL JSON schema to the `GraphQLGenerated` folder and name it `schema.json`.
6060

6161
#### 4. Add Queries And Mutations Folders
62-
Add `Queries` and `Mutations` folders to `GraphQLAPI` folder.
62+
Add `Queries` and `Mutations` folders to `GraphQLGenerated` folder.
6363

6464
#### 5. Define Your first GraphQL Query Or Mutation
6565
Add your first Query or Mutation and save it with `.graphql` extension to `Queries` or `Mutations` folders.
@@ -72,43 +72,43 @@ Add script:
7272
SDKROOT=$(/usr/bin/xcrun --sdk macosx --show-sdk-path)
7373
SWIFT_PACKAGES="${BUILD_DIR%/Build/*}/SourcePackages/checkouts"
7474

75-
${SWIFT_PACKAGES}/GraphQLAPIKit/Resources/apollo-ios-cli generate --path ./GraphQLAPI/apollo-codegen-config.json
75+
${SWIFT_PACKAGES}/GraphQLAPIKit/Resources/apollo-ios-cli generate --path ./GraphQLGenerated/apollo-codegen-config.json
7676
```
7777

7878
#### 7. Disable User Script Sandboxing
7979
Go to your application main target's Build Settings and set `User Script Sandboxing` to `NO`
8080

8181
#### 8. Build your main target
8282

83-
#### 9. Add GraphQLAPI local package
83+
#### 9. Add GraphQLGenerated local package
8484
- Go to Xcode -> File -> Add Package Dependencies..
8585
- Choose `Add Local...`
86-
- Add `GraphQLAPI` as local Swift Package.
87-
Make sure, that `GraphQLAPI` library was added to your main's target `Frameworks, Libraries, and Embedded Content` list.
88-
For your project's test target add `GraphQLAPIMocks` library if necessary.
86+
- Add `GraphQLGenerated` as local Swift Package.
87+
Make sure, that `GraphQLGenerated` library was added to your main's target `Frameworks, Libraries, and Embedded Content` list.
88+
For your project's test target add `GraphQLGeneratedMocks` library if necessary.
8989

9090
#### 10. Update `.gitignore` file
9191
Add `*.graphql.swift` to your repository's git ignore file to ignore Apollo generated code.
9292

9393
**Content of generated `Schema` folder has to be commited to the repository**
9494

95-
#### 11. Exclude `GraphQLAPI` folder from your linter's rule if necessary
95+
#### 11. Exclude `GraphQLGenerated` folder from your linter's rule if necessary
9696

9797
## Usage
9898

9999
### Defining Query or Mutation
100100
```swift
101-
import GraphQLAPI
102101
import GraphQLAPIKit
102+
import GraphQLGenerated
103103

104104
let query = MyExampleQuery()
105105
let mutation = MyExampleMutation()
106106
```
107107

108108
### Fetching the query/perform mutation
109109
```swift
110-
import GraphQLAPI
111110
import GraphQLAPIKit
111+
import GraphQLGenerated
112112

113113
let apiAdapter = GraphQLAPIAdapter(url: URL(string: "https://MyAPIUrl.com")!)
114114
let queryResult = await apiAdapter.fetch(query: query)

0 commit comments

Comments
 (0)