LinkDylibError when previewing SwiftUI view from a package.

I have two (local) Swift packages (both with a single library product): RemoteImage, which defines setImage(from:) function on UIImageView and SatelitUI package which directly depends on the first one and defines some views. But when I'm trying to preview views from the second package I'm getting the following error:

Code Block
linker command failed with exit code 1 (use -v to see invocation)
----------------------------------------
LinkDylibError: Failed to build TrailerView.swift
Linking failed: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: directory not found for option '-F/Applications/Xcode-beta.app/Contents/SharedFrameworks-iphonesimulator'
Undefined symbols for architecture x86_64:
  "(extension in RemoteImage):C.UIImageView.setImage(from: Foundation.URL?) -> ()", referenced from:
      (extension in SatelitUI_PreviewReplacement_TrailerView_2):SatelitUI.TrailerView.(preview__update in _8C3731B0EF007627509BEEB93277D681)(with: SatelitUI.Trailer?) -> () in TrailerView.2.preview-thunk.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Apparently, Xcode fails to link the library from the first package because it's dynamic. Static linking works as expected.

It's a bug I believe?
Answered by Developer Tools Engineer in 616507022
Yah, this looks like a bug to me, too. Could you please file a feedback report with your example attached? Thank you!
Accepted Answer
Yah, this looks like a bug to me, too. Could you please file a feedback report with your example attached? Thank you!

The accepted answer is not an answer, but a comment. I have the similar issue with ACarousel preview.

LinkDylibError: Failed to build PaywallCarousel.swift

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

This discussion is similar and have much more activity: https://forums.developer.apple.com/forums/thread/736152?page=2

LinkDylibError when previewing SwiftUI view from a package.
 
 
Q