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
Post
Replies
Boosts
Views
Activity
I got this same error but for me it was because I had:
.frame(width: .infinity)
instead of:
.frame(maxWidth: .infinity)
Had to do the ol' comment out some lines until it runs trick and then uncomment one-by-one to find it.