Hi!
I'm struggling with SwiftUI previews in a very specific context. I have a workspace with a framework project (objC to make things even easier :D) that has Cocoapods dependencies, and another framework project in Swift with SwiftUI views inside. The latest framework also have dependencies with SPM and has an internal dependency to the objC framework.
-- Workspace
---- ObjC framework
------ Cocoapod libs
---- SwifUI framework (that relies on the objC framework)
------ SPM libs
Inside the SwiftUI framework, though the project compiles well, I can't render the SwiftUI views (I had to create them in an another completely separated project to create the Views). But now I have to link the data part that relies on the objC framework, so I cannot use an external project anymore.
Here is the error (I replaced the framework name and object name for NDA reasons) :
Linking failed: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator'
Undefined symbols for architecture x86_64:
"___llvm_profile_runtime", referenced from:
___llvm_profile_runtime_user in ObjCFramework(VariousObject.o)
// and many more below
...
(maybe you meant: ___llvm_profile_runtime_user)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Basically, Xcode does not find some symbols from the objC framework though both framework compile well :-/
I found a similar post but the solution, as stated in the comments, does not work for SPM based frameworks.
Had anyone even the tiniest idea on how to make SwiftUI previews work ?
Thanks!