Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In #Preview macro, can't use @Previewable or "ungrouped" views. #106

Closed
gabriel opened this issue Feb 20, 2025 · 0 comments · Fixed by #108
Closed

In #Preview macro, can't use @Previewable or "ungrouped" views. #106

gabriel opened this issue Feb 20, 2025 · 0 comments · Fixed by #108

Comments

@gabriel
Copy link

gabriel commented Feb 20, 2025

Context 🕵️‍♀️

In #Preview macro, can't use @Previewable or "ungrouped" views.

What 🌱

@Previewable macro not supported... e.g.

#Preview {
  @Previewable @State var count = 1
  Button("Increment \(count)") { count += 1 }
}

or ungrouped views:

#Preview {
  Text("Foo")
  Text("Bar")
}

Proposal 🎉

Get the generated SwiftUI View from the evaluated #Preview macro (instead of the macro content) and include that as the view? But idk if that is possible with Sourcery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant