Skip to content

Commit c062bda

Browse files
committed
Apply tag modifier from attributes
1 parent d0c4ec3 commit c062bda

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Sources/LiveViewNative/ViewTree.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,21 @@ struct ViewTreeBuilder<R: RootRegistry> {
7373

7474
let modified = view.applyModifiers(R.self)
7575
let bound = applyBindings(to: modified, element: element, context: context)
76-
let withID = applyID(element: element, to: bound)
77-
return withID
76+
let withIDAndTag = applyIDAndTag(element: element, to: bound)
77+
78+
return withIDAndTag
7879
.environment(\.element, element)
7980
.preference(key: ProvidedBindingsKey.self, value: []) // reset for the next View.
8081
}
8182

8283
@ViewBuilder
83-
private func applyID(element: ElementNode, to view: some View) -> some View {
84+
private func applyIDAndTag(element: ElementNode, to view: some View) -> some View {
85+
let tag = element.attributeValue(for: "tag")
86+
8487
if let id = element.attributeValue(for: "id") {
85-
view.id(id)
88+
view.id(id).tag(tag)
8689
} else {
87-
view
90+
view.tag(tag)
8891
}
8992
}
9093

0 commit comments

Comments
 (0)