Skip to content

Commit

Permalink
Complete ContainerValue's example
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumisilk committed Aug 20, 2024
1 parent 083e7b6 commit 9efd808
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions Example/Example/ContainerValueExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ import SwiftUI
import AnySubviews

struct ContainerValueExample: View {

var body: some View {
VStack {
List {
BackportGroup(subviews: content) { subviews in
Text("Original View:")
subviews

Text("Custom Container Values:")
Section {
subviews
} header: {
Text("Original View:")
}

ForEach(subviews) { subview in
let number = subview.containerValues[\.myNumber]?.description ?? "nil"
let name = subview.containerValues[\.myName] ?? "nil"
Text(number + " " + name)
Section {
ForEach(subviews) { subview in
let number = subview.containerValues[\.myNumber]?.description ?? "nil"
let name = subview.containerValues[\.myName] ?? "nil"
Text(number + " " + name)
}
} header: {
Text("Custom Container Values:")
}
}
}
Expand Down

0 comments on commit 9efd808

Please sign in to comment.