In my own fairly complex DocumentGroup app, I've been having a problem with bottom bar items appearing briefly when first drawn, and then disappearing. This seems to be caused by the invalidation of one or more views in the hierarchy.
In Apple's own WritingApp, which is designed to demonstrate DocumentGroup, adding a bottom bar item to the toolbar demonstrates the problem:
This toolbar is on the StoryView:
ToolbarItem() {
Button("Show Story", systemImage: "book") {
isShowingSheet.toggle()
}
.sheet(isPresented: $isShowingSheet) {
StorySheet(story: document.story, isShowingSheet: $isShowingSheet)
.presentationSizing(.page)
}
}
// This does not persist
ToolbarItem(placement: .bottomBar) {
Button("Foo") { }
}
}
My 'Foo' button is new. What happens is that it persists for a few seconds; its disappearance coincides with the writing of the file to disk, it seems. I would dearly like it to persist! I've tried adding an ID, setting the toolbar visibility and so on, but no luck. Anyone had this working?