Closed kortac closed 5 years ago
Have you set up the Input/Output Files of the build phase?
This is probably related to #76 - we need a better "Did anything change? No? Then don't regenerate." mechanism.
I've added documentation of the workaround to the Advanced Codegen Tips And Tricks section of our documentation. If you're still having issues after setting that up, please file a new issue. Thank you!
(Note that I'm still planning to add XCFileList generation as part of the Swift Codegen project, but that workaround should get you through until that's up and running)
Hey Team Apollo,
I was running into problems with SwiftUI previews not displaying and stumbled upon this thread. I am running the latest versions of Xcode (13.4.1) and Apollo (0.51.0).
I tried adding the InputOutput files recommended in 'Advanced codegen tips and tricks'. However this didn't work.
What fix it for me was to add
if [ "${ENABLE_PREVIEWS}" = "YES" ]; then
echo "Previews enabled, quitting to prevent 'preview paused'."
exit 0;
fi
To the beginning of the codgen build phase script. Not sure if this is the correct approach. But just thought I would add my 2 cents just incase anyone else gets stuck.
Thanks @heliumdice, there has been some discussion around that environment variable already - https://github.com/apollographql/apollo-ios/pull/2257.
When using Apollo with the build phase script as stated in the docs the automatic preview of SwiftUI is paused every time the script was executed and has to be resumed manually.
Intended outcome
Even with the build phase script active, automatic preview should not be paused after Xcode built the preview files for SwiftUI files.
Actual outcome
With the build phase script active user has to manually resume automatic preview every time Xcode built the preview.
How to reproduce the issue
ContentView.swift
and resume preview. Preview is rendered and automatic preview paused after that.ContentView.swift
and resume preview. Preview is rendered again and again automatic preview paused after that.Generate Apollo GraphQL API
build phase (or addexit 0
at the beginning).