8000 GitHub - V8tr/KeyboardAvoidanceSwiftUI: How to move SwiftUI view up when keyboard appears https://www.vadimbulavin.com/how-to-move-swiftui-view-when-keyboard-covers-text-field/
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

V8tr/KeyboardAvoidanceSwiftUI

Repository files navigation

Article related to this project


KeyboardAvoidanceSwiftUI

A sample project showing how to move SwiftUI view up when keyboard covers a text field.

Usage:

struct ContentView: View {
    @State private var text = ""
    
    var body: some View {
        VStack {
            Spacer()
            
            TextField("Enter something", text: $text)
                .textFieldStyle(RoundedBorderTextFieldStyle())
        }
        .padding()
        .keyboardAdaptive() // <--- Apply the view modifier
    }
}

Result:

How to manage the iOS system keyboard when it covers a SwiftUI text field

Releases

No releases published

Packages

No packages published

Languages

0