[ad_1]
It appears that there’s a distinction in exhibiting a Checklist Part header while you embed the Checklist in a VStack. Does anyone know why this occurs?
struct ContentView: View {
@State var toggle: Bool = false
let gadgets: [String] = ["Apple", "Pear", "Banana"]
var physique: some View {
NavigationView {
if toggle {
VStack {
checklist
}
} else {
checklist
}
}
}
var checklist: some View {
Checklist {
Part {
ForEach(gadgets, id: .self) { merchandise in
Textual content(merchandise)
}
} header: {
Textual content("Fruit")
}
}
.navigationTitle(toggle ? "VStack" : "No VStack")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button {
toggle.toggle()
} label: {
Textual content("Toggle")
}
}
}
}
}
[ad_2]


