XCode Previews do not work when defined in a Swift Package in XCode 15 beta 6. The following error will be returned when trying to show a SwiftUI Preview:
FailedToInstallAppError: Failed to install ”XCPreviewAgent.app”
Could not install the preview host ”XCPreviewAgent.app” on iPhone 14 Pro
...
HumanReadableNSError: Simulator device returned an error for the requested operation.
Ensure your bundle contains a valid CFBundleShortVersionString.
As far as I know, a Swift Package doesn't need a CFBundleShortVersionString declared? Am I missing something?
Replicate Error
To replicate the error, simply create a new SPM package from XCode, and create a Preview:
struct Preview: PreviewProvider {
static var previews: some View {
Group {
Text("Hello")
}
}
}
Does anyone know of any workaround this issue?
5
1
4.1k