feedback-assistant / reports

Open collection of Apple Feedback Assistant reports
200 stars 2 forks source link

FB9957111: SwiftUI fail to preview dependented Package PreviewProvider #296

Open Kyle-Ye opened 2 years ago

Kyle-Ye commented 2 years ago

Description

Please describe the issue: Say I have package A and package B, both of them have some SwiftUI PreviewProvider. And A depends on B (A -> B). When opening Package A, I can preview B’s SwiftUI PreviewProvider as well. This is the expected behavior.

However, if there is a package C, and both A and B depend on C. Then when opening Package A, I can not preview B’s SwiftUI PreviewProvider. The diagnostics will tell me that the linker failed to link C.

I think there is some link-related logic issue on SwiftUI Preview.

Please list the steps you took to reproduce the issue: Making 3 simple Package: A B C Add simple SwiftUI preview in Package A and B Make A depends on B and C Make B depends on C Opening Package.swift in folder A. Go the package B to preview and fail.

What did you expect to happen? Package B previews normally.

What actually happened? Package B fails to preview.

Kyle-Ye commented 2 years ago

A temp workaround is to disable the testTarget in the A Package.

See Minimum reproducible environment FolderTest.zip