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.

Accepted Reply

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.

  • That's a good workaround, thanks!

Add a Comment

Replies

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.

  • That's a good workaround, thanks!

Add a Comment