SwiftUI Previews broken on local Swift Package with dependencies

I have a project with two local packages

  • One client package with an interface and some models with dynamic type in the Package.Swift
  • One feature package with the UI and a dependency to the client package

When I try to preview a view that is not using any models or code from the client package, it loads just fine e.g. a view that is just a container to display things like a card

But when I tried to preview any other view that actually uses models from the client package, it just fails

the first few lines of the preview error display

LinkDylibError: Failed to build <filename>.swift
Linking failed: linker command failed with exit code 1 (use -v to see invocation)

ld: warning: search path '/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks-iphonesimulator' not found
    Undefined symbols for architecture arm64:

Also, I'm using Xcode 15.4 and iOS 17 as the min version

Did you find the solution to this?

SwiftUI Previews broken on local Swift Package with dependencies
 
 
Q