Post

Replies

Boosts

Views

Activity

How to preview with package
How do you get previews working in a swift package? This talk shows this working, however the following steps do not work. Using Xcode 13.2.1 create a new Swift Package Add a simple view with a preview to that swift package (See code below) Attempt to run the preview. code: import SwiftUI @available(iOS 14.0, *) public struct TestView: View {   public init() {   }   public var body: some View {     Text("Hello World")   } } @available(iOS 14.0, *) struct NoDataView_Previews: PreviewProvider {   static var previews: some View {     TestView()   } } #endif See errors: ================================== | RemoteHumanReadableError |   | LoadingError: failed to load library at path "/Users/fishycx/Library/Developer/Xcode/DerivedData/MyLibrary-cwtaivijrddzbkeegisudpueggjw/Build/Intermediates.noindex/Previews/MyLibrary/Products/Debug-iphonesimulator/PackageFrameworks/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct.framework/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct": Optional(dlopen(/Users/fishycx/Library/Developer/Xcode/DerivedData/MyLibrary-cwtaivijrddzbkeegisudpueggjw/Build/Intermediates.noindex/Previews/MyLibrary/Products/Debug-iphonesimulator/PackageFrameworks/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct.framework/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct, 0x0000): tried: '/Users/fishycx/Library/Developer/Xcode/DerivedData/MyLibrary-cwtaivijrddzbkeegisudpueggjw/Build/Intermediates.noindex/Previews/MyLibrary/Products/Debug-iphonesimulator/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct.framework/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/fishycx/Library/Developer/Xcode/DerivedData/MyLibrary-cwtaivijrddzbkeegisudpueggjw/Build/Intermediates.noindex/Previews/MyLibrary/Products/Debug-iphonesimulator/PackageFrameworks/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct.framework/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct' (no such file), '/Users/fishycx/Library/Developer/Xcode/DerivedData/MyLibrary-cwtaivijrddzbkeegisudpueggjw/Build/Intermediates.noindex/Previews/MyLibrary/Products/Debug-iphonesimulator/PackageFrameworks/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct.framework/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Library/Frameworks/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct.framework/MyLibrary_-71ED4B7C0CDEC55C_PackageProduct' (no such file))
1
1
538
Feb ’22