Post

Replies

Boosts

Views

Activity

Build for Preview without having the SwiftUI Preview open
It would be great to be able to build for Preview without having the SwiftUI Preview open. That way the preview will be ready without rebuilding when coming back to it. Any way to do that? Steps to reproduce: go to another file (not a view) like a view model implement some logic and compile a few time during the implementation go back to the preview, compilation take a lot of time because it now compile for another target I guess Solution: Add a shortcut in Product > Build For > Preview. That way I can compile for preview from anywhere easily.
1
1
1.3k
Jun ’22
Why Build for Preview is different from Build (for Simulator)?
When building for Preview it is using the iOS Simulator SDK and the destination selected. When you build the Preview for one view it actually compile for the whole target. You can try it by launching the preview on one view successfully, then go to another view without making any change. That preview will appear instantaneously. So it look very similar to what's happening when launching on a simulator. I am not sure why it needs to rebuild between the Preview and the actual simulator, any documentation / information about that would be great. I notice that changing the simulator destination doesn't rebuild anything for the Preview.
1
0
1.2k
Jun ’22