Skip to content

Commit

Permalink
1.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nathantannar4 committed May 15, 2024
1 parent c7fc37a commit ef996a2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
35 changes: 28 additions & 7 deletions Sources/Engine/Sources/MultiViewAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,35 @@ public struct MultiViewAdapter<

struct MultiViewAdapter_Previews: PreviewProvider {
static var previews: some View {
MultiViewAdapter {
Text("Hello")
Text("World")
} content: { subviews in
ForEachSubview(subviews) { index, subview in
subview
.border(Color.red)
VStack {
MultiViewAdapter {
Text("Hello")
Text("World")
} content: { subviews in
ForEachSubview(subviews) { index, subview in
subview
.border(Color.red)
}
}
}
.previewDisplayName("TupleView")

VStack {
MultiViewAdapter {
Section {
Text("Content")
} header: {
Text("Header")
} footer: {
Text("Footer")
}
} content: { subviews in
ForEachSubview(subviews) { index, subview in
subview
.border(Color.red)
}
}
}
.previewDisplayName("Section")
}
}
12 changes: 9 additions & 3 deletions Sources/EngineCore/SectionVisitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,27 @@ private struct SectionSubviewIterator<
) {
var context = context
context.traits = []
var headerContext = context.union(.header)
headerContext.id.append(offset: 0)
visitor.value.visit(
content: content.parent,
context: context.union(.header),
context: headerContext,
stop: &stop
)
guard !stop else { return }
var contentContext = context
contentContext.id.append(offset: 1)
content.content.visit(
visitor: visitor,
context: context,
context: contentContext,
stop: &stop
)
guard !stop else { return }
var footerContext = context.union(.footer)
footerContext.id.append(offset: 2)
visitor.value.visit(
content: content.footer,
context: context.union(.footer),
context: footerContext,
stop: &stop
)
}
Expand Down

0 comments on commit ef996a2

Please sign in to comment.