Hi, i've already submitted a feedback for this after beta 3 came out (FB10596836), but I was wondering whether anyone else had come across this and found a reasonable work around (or was prepared to submit more feedbacks).
Essentially, prior to iOS 16 beta 3, Views in SwiftUI would move up to avoid the keyboard if there was a Spacer() above the view. The Spacer would shrink when the keyboard appeared, and grow when the keyboard disappears.
From iOS 16 beta 3 onwards, this does still work, up until you open the control centre. For whatever reason, once that's been opened, Spacer() objects no longer shrink or grow properly, meaning views no longer avoid the keyboard.
You can replicate this with the following simple code in a new project:
struct ContentView: View {
@State private var text: String = ""
var body: some View {
VStack {
Spacer() // This spacer should shrink when keyboard appears
TextField("Enter text:", text: $text)
.border(.gray)
Spacer().frame(height: 16)
}
}
}
You can test this on any device/sim running iOS 15 (or 16 beta 1), and then on the latest beta. You can observe that before opening the control centre, the text view moves up/down, but after opening the control centre it is stuck in its current position.
Hopefully someone can tell me if I'm being an idiot somewhere, if you have any insight into whether this is actually broken, it would be highly appreciated.