can't use #Preview for widgets code compatible with iOS < 17

Can't compile existing project with new #Preview macros. Get: 'Preview' is only available in application extensions for iOS 17.0 or newer

And because macros generate struct I can't use #available to fix this.

Does anyone have any ideas how to fix this?

I guess the only solution is to create new macros that will work like #available(iOS 17) { code } and remove the code for older iOS?

Hi,

Sorry to hear you are having problems getting the new previews macro working in a project that has an older deployment target. This is a known issue that we hope to resolve in an upcoming seed build.

Currently the only workaround would be to change the projects deployment target, or to keep using a PreviewProvider struct.

can't use #Preview for widgets code compatible with iOS &lt; 17
 
 
Q