Search code examples
iosswiftxcodekeyboarduitabbarcontroller

Swift prevent TabBar from moving up when Keyboard is active


so whenever My Keyboard toggles the Tabbar moves up with it like shown in the image. Is there a way to prevent this when the Keyboard is active? My version is iOS 14 and XCode 12 Thanks in advance!

/// Corretion: How can I modify any View in SwiftUI to prevent moving up when the Keyboard shows up?

struct SwiftUIView: View {
@State var text = ""
var body: some View {
        VStack{
        TextField("Text", text: $text)
            Text(">>Don't Move Me Up When Keyboard Is Active<<")
    }
}

}

Paul

simulator view when tabbar moves up when keyboard is active


Solution

  • try adding the following modifier to your tabbar:

    .ignoresSafeArea(.keyboard, edges: .bottom)