Post

Replies

Boosts

Views

Activity

Swift package breaks SwiftUI Xcode previews
I'm working on a new project supporting iOS 14 & 15 in Xcode 13. It's all swift and a combination of UIKit ad SwiftUI. Previews in the canvas were working great until a SwiftUI view was referenced from another view controller that imports our swift package. I'm using an intel Mac. The diagnostic linker errors in the canvas range from things like: HumanReadableSwiftError ConfigurationError: noPreviewInfos(architecture: x86_64, sdkRoot: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk") or Could not find module 'MyModule' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64   I've searched around and tried things I've seen suggested elsewhere, like excluding the arm64 architecture, building active architecture only, etc... None of those seem to address the issue, and usually just produce slightly different error messages. The swift packages I'm using are just plain swift packages that work fine otherwise. They don't have any dependencies of their own. Is this just an issue between SPM and SwiftUI? Is there something I need to adjust to make all of these things work together? I also tried reproducing the issue in a new project, and as soon as a file that imports my framework touches a SwiftUI file in any way, previews are broken for the whole app with linker errors. Any help or just a sanity check are much appreciated. Most similar issues I find by searching around are using 3rd party dependency managers or have more complicated setups. This is a pretty easy/straightforward one and I can't seem to get past it.
1
0
1k
Oct ’21