This is very important part of implementing Apollo GraphQL in iOS project.
- Create new Run script phase in your Xcode project. Follow the steps.👇
- Click your project in your file hierarchy and select project in targets.
- Then click on build phases.
- Click + icon.
- Then click New run script phase.
Example 👇
5. Then rename your new run script → Apollo GraphQL run script
Copy this 👇 script code and paste in Xcode Apollo GraphQL run script
After building this project you got 1 error something like this → Command PhaseScriptExecution failed with a nonzero exit code
To solve this you need to make new empty file name is quary.graphql
then add queries into your GraphQL file like this.👇🏼
And then build you project.
your project build successful but API.swift file is not comings.
your API.swift file is not available in your project its available in your local storage ok. so drag & drop into your project 👇🏼
Now if you edit your Query.graphql file (Add & Remove) Query, then you will see changes on your API.Swift file.
Your API.swift file should be look something like this 👇🏼
Congratulations Again. 🥳 🎉 👏 🙌 🍾 🥂 🎊 .
You Achieved bigger achievement.