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.

Answered by Developer Tools Engineer in 718838022

Hi,

Thanks for your suggestions. When doing a workflow like this I will often "pin" the preview that I am actively working on so that when I bounce to another file (for example a model, view model or manager/controller) my preview will keep updating or is easily accessible to refresh if it paused.

Accepted Answer

Hi,

Thanks for your suggestions. When doing a workflow like this I will often "pin" the preview that I am actively working on so that when I bounce to another file (for example a model, view model or manager/controller) my preview will keep updating or is easily accessible to refresh if it paused.

Build for Preview without having the SwiftUI Preview open
 
 
Q