Background
I am constructing a SwiftUI kind (AddRecipeView) inside a NavigationStack
. I’ve added a .toolbar(placement: .keyboard)
with a “Finished” button to dismiss the keyboard, particularly helpful for numberPad inputs.
Nevertheless, the “Finished” button doesn’t seem the primary time I enter this view and faucet a TextField
. After navigating away to another tab and returning and hitting thre TextField
once more, the “Finished” button reveals up accurately. This conduct occurs on each simulator and bodily machine (each examined with iOS 18.5, and XCode’s model being 16.5).
Here is a simplified reproducible instance, but when anybody needs to examine your complete venture, it may be discovered on this repo:
struct AddRecipeView: View {
@State personal var time: Int? = nil
@State personal var path = NavigationPath()
var physique: some View {
NavigationStack(path: $path) {
Type {
TextField("Time (minutes)", worth: $time, formatter: NumberFormatter())
.keyboardType(.numberPad)
}
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button("Finished") {
UIApplication.shared.sendAction(
#selector(UIResponder.resignFirstResponder),
to: nil, from: nil, for: nil)
}
}
}
}
}
}
Console output
After I hit on the TextField for the second time (as soon as I’ve traveled to a different tab and are available again), I get these output console messages:
-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] carry out enter operation requires a sound sessionID. inputModality = Keyboard, inputOperation = , customInfoType = UIEmojiSearchOperations
Invalid body dimension (unfavourable or non-finite).
Unable to concurrently fulfill constraints.
In all probability a minimum of one of many constraints within the following checklist is one you do not need.
...
""""""0x6000021a9e00>0x6000021aa6c0>0x6000021c7250>
—