Closed ynnckcmprnl closed 6 months ago
Thanks for starting the issue!
As a quick fix, I can suggest adding a name to the #Preview
.
For example:
#Preview("Redacted") {
VStack {
Redacted("Hello, World!", .style1, .color1)
}
}
PS: I am currently making a Pull Request with a fix)
A new version with a fix has been released: https://github.com/BarredEwe/Prefire/issues/47
Thanks! This resolves the curly brace issue.
Although I've ran into another problem: https://github.com/BarredEwe/Prefire/issues/49
Context π΅οΈββοΈ
I'm integrating Prefire 2.1.1 in a SwiftUI Design System package.
What π±
The #Preview macro causes the
PreviewTests.generated
file to contain compile errors. It seems that in some cases the #Preview macro breaks the generated code. Error:Expected '(' in argument list of function declaration
.When I remove the #Preview macro and create the SwiftUI preview with the old method, the compiler will fail on another one of these errors, but for a different preview. It seems like Prefires parsing of the #Preview macro is incorrectly adding a curly brace to the name in the generated code.
Example #Preview:
The generated code in
PreviewTests.generated
, note theVStack{
reference in the name.