code-connect icon indicating copy to clipboard operation
code-connect copied to clipboard

[SwiftUI] FigmaApply to support using Figma property values in conditional blocks

Open danielsinclairtill opened this issue 1 year ago • 0 comments

Describe the feature you'd like:

I am requesting an additional feature for the SwiftUI .figmaApply function.

If I define the code connect SwiftUI code generation like below:

@FigmaBoolean("useLabel?")
var useLabel: Bool = false

@FigmaString("label")
var label: String = "Label"

MyComponent()
    .figmaApply(useLabel) {
        $0.accessibilityLabel(label)
    }

In Figma Code Connect playground, when setting the useLabel? property to true, and the label property to something like Test, instead of the expected generated SwiftUI code block :

MyComponent()
    .accessibilityLabel("Test")

it will always generates the code:

MyComponent()
    .accessibilityLabel(label)

It would be much appreciated if we could also support using other Figma properties inside the figmaApply conditional blocks, so the result would be like the expected generated SwiftUI code block above.

Thank you!

danielsinclairtill avatar Jan 09 '25 16:01 danielsinclairtill