Specify the required Pod version here. Then, only when the files differ you move the temporary file into place.Kotlin("coapods") version "1.9.10" If for some reason the input/output file setup above doesn't work for you, you can also decide to first write the file to a temporary location, and then compare this temporary file to the current one. There's an open issue to auto-generate input and output file lists which will be addressed as part of Apollo iOS 1.0, but this will help until that's done. The script will still run if you explicitly build and run. This should prevent automatic rebuild cycles if none of the InputFiles are changed. Then, you can add $(SRCROOT)/YourTarget/API.swift (the path you're running it from + the output file) to the list of Output Files : 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 operation s 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |