I’m encountering an issue in iOS 18.5 (and most probably across all iOS 18 versions) where the keyboard toolbar defined with .toolbar(.keyboard) does not appear immediately when a TextField becomes first responder inside a fullScreenCover. Here’s a minimal reproducible example:
import SwiftUI
struct ContentView: View {
@State private var text: String = ""
@State private var showSheet: Bool = false
var body: some View {
NavigationStack {
Button("Show Sheet") {
showSheet.toggle()
}
.fullScreenCover(isPresented: $showSheet) {
NavigationStack {
VStack {
Button("Dismiss") {
showSheet.toggle()
}
TextField("Enter text", text: .constant("Hello"))
.autocorrectionDisabled()
.textInputAutocapitalization(.never)
}
.padding()
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
toolBar
}
}
}
}
}
}
private var toolBar: some View {
HStack {
Spacer()
Button("Done") {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}
}
}
✅ Expected Behavior:
- When the TextField becomes active and the keyboard appears, the custom keyboard toolbar with a “Done” button should also appear immediately.
❌ Actual Behavior:
- On first presentation of the sheet and focusing the TextField, the toolbar is missing.
- If I background the app and return, the toolbar appears as expected.
- Dismissing and re-opening the sheet leads to the same issue (toolbar missing again).