Xcode Version 15.2 (15C500b)
Here's the weird thing, it ONLY works if the sheet or parent view that opens the sheet is within a NavigationStack.
For example, this code fails to show the Keyboard button UNLESS you comment out one of those NavigationStacks:
struct ContentView: View {
@State var isPresented = false
var body: some View {
// NavigationStack { // Works
Button {
isPresented.toggle()
} label: {
Text("Button")
}
.sheet(isPresented: $isPresented) {
SubView()
}
// }
}
}
struct SubView: View {
@State var text = ""
var body: some View {
// NavigationStack { // Works
TextEditor(text: $text)
.toolbar {
ToolbarItemGroup(placement: .bottomBar) {
Button("Bottom Bar") {
}
}
ToolbarItemGroup(placement: .keyboard) {
NavigationStack {
Button("Keyboard") {
}
}
}
}
// }
}
}
FB13532834 Keyboard toolbar button does not display within sheet
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: