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.

Answered by Developer Tools Engineer in 719092022

Hi,

We enable some additional build options and compiler flags when building for previews. You can dig in to the build log in Xcode and compare it to a normal simulator build if you want to see more specifics on that. We additional do little special compilations to enable the live-updating-without-having-to-do-a-full-incremental-build.

Accepted Answer

Hi,

We enable some additional build options and compiler flags when building for previews. You can dig in to the build log in Xcode and compare it to a normal simulator build if you want to see more specifics on that. We additional do little special compilations to enable the live-updating-without-having-to-do-a-full-incremental-build.

Why Build for Preview is different from Build (for Simulator)?
 
 
Q