

If you're using a tool like Interface Builder or SwiftUI to talk to a module with its own code generation build step, this is helpful to prevent the API.swift file from causing an auto-regeneration loop.įor example, if you're using something like this to run your code generation for a target called YourTarget:Īssuming you've set the script to run from $(SRCROOT)/YourTarget, you can add $(SRCROOT)/YourTarget/**/*.graphql (the path you're running it from + the glob you're passing to the includes CLI parameter) to the list of Input Files for your Apollo Run Script Build phase.

Prevent unnecessary recompilation Set up input and output files in your build phase Advanced codegen tips and tricksĪfter you get up and running, here are a few improvements you can make to your codegen process. You can also continue reading below for some advanced codegen tips. To learn how, next check out Creating a client and Fetching queries. Installation complete! You can now start executing GraphQL operations in your app. Then, make sure you've checked all the Targets the API file needs to be included in. Make sure to uncheck the "Copy Files If Needed" checkbox, because it should already be in your project's folder system. Note: Because Apollo iOS generates operation-specific result types, API.swift is mostly empty at this point unless you've already added multiple.
