SwiftUI Preview: Updating took more than 5 seconds for non-main target (framework target)

While selecting a framework rather than the executable as the active scheme,
SwiftUI preview cannot use: Updating took more than 5 seconds.

However, while selecting the main app target, it can work perfectly.

Repro steps:
  1. git clone https://github.com/imWildCat/NonExecutableTargetCannotUseSwiftUIPreviewDemo

  2. cd NonExecutableTargetCannotUseSwiftUIPreviewDemo

  3. xed NonExecutableTargetCannotUseSwiftUIPreviewDemo.xcworkspace

  4. Select the “SharedUI” target as the active scheme

  5. Open the WebImage.swift source file

  6. Run the SwiftUI preview

Please note that, if you use the main app target (executable rather than the frame), it can be previewed.
Submitted a feedback: FB9095334

Hi,

Sorry to hear you are having problems getting previews working.

Thanks for filing the feedback. I've made sure it got routed to the right team so it can get looked at as soon as possible!

I've the same problem. Preview on iOs scheme is working fine but if I switch to macOS scheme I got the same error.

Did you find a fix?

SwiftUI Preview: Updating took more than 5 seconds for non-main target (framework target)
 
 
Q