@Previewable

Asked on 09/05/2024

1 search

The @Previewable macro is a new feature introduced in Xcode 16, which allows you to attach it to property wrappers like state. This enables you to use them directly within a preview block, eliminating the need to write wrapper views. This feature simplifies the process of creating previews by allowing you to define your state right in the previews body and attach the @Previewable macro. This tells the preview system to create a wrapper view behind the scenes, making it easier to see your UI live with minimal code.

For more details, you can refer to the session What’s new in Xcode 16 (03:04).