---
title: Previewable()
framework: swiftui
role: symbol
role_heading: Macro
path: swiftui/previewable()
---

# Previewable()

Tag allowing a dynamic property to appear inline in a preview.

## Declaration

```swift
@attached(peer) macro Previewable()
```

## Overview

Overview Tagging a variable declaration at root scope in your #Preview body with ‘@Previewable’ allows you to use dynamic properties inline in previews. The #Preview macro will generate an embedded SwiftUI view; tagged declarations become properties on the view, and all remaining statements form the view’s body. #Preview("toggle") {     @Previewable @State var toggled = true     return Toggle("Loud Noises", isOn: $toggled) } It is an error to use @Previewable outside of a #Preview body closure.

## See Also

### Defining a preview

- [PreviewProvider](swiftui/previewprovider.md)
- [PreviewPlatform](swiftui/previewplatform.md)
- [previewDisplayName(_:)](swiftui/view/previewdisplayname(_:).md)
- [PreviewModifier](swiftui/previewmodifier.md)
- [PreviewModifierContent](swiftui/previewmodifiercontent.md)
