Skip to content

Commit f9a05a8

Browse files
Conditionally apply tag
Co-authored-by: Carson Katri <[email protected]> Signed-off-by: May Matyi <[email protected]>
1 parent 65aae52 commit f9a05a8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/LiveViewNative/ViewTree.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ struct ViewTreeBuilder<R: RootRegistry> {
9292

9393
@ViewBuilder
9494
private func applyTag(element: ElementNode, to view: some View) -> some View {
95-
let tag = element.attributeValue(for: "tag")
96-
97-
view.tag(tag)
95+
if let tag = element.attributeValue(for: "tag") {
96+
view.tag(Optional<String>.some(tag))
97+
} else {
98+
view
99+
}
98100
}
99101

100102
@ViewBuilder

0 commit comments

Comments
 (0)