Did something change as far as how to use #Preview macros in Xcode 15 Beta 8? This code used to work fine but now no longer compiles because of == PREVIEW UPDATE ERROR: CompileDylibError: Failed to build WatchRecoveryWidget.swift Compiling failed: cannot convert value of type 'WatchRecoveryScoreTimeLineEntry' to closure result type 'any View'
#Preview(as: WidgetFamily.accessoryRectangular) {
WatchRecoveryScoreWidget()
} timeline: {
WatchRecoveryScoreTimeLineEntry(date: Date(), recoveryScore: 75, subscriptionIsActive: true)
}
I was able to address this issue by adding @available(iOS 17.0, *) above each my of previews. Not sure why the error it shows is so misleading, but hopefully that gets addressed in a future Xcode 15 update.
So your preview would look like this now:
@available(iOS 17.0, *)
#Preview(as: .accessoryRectangular) {
WatchRecoveryScoreWidget()
} timeline: {
WatchRecoveryScoreTimeLineEntry(date: .now, recoveryScore: 75, subscriptionIsActive: true)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With