Swiftpack.co - ralfebert/KeyboardAwareSwiftUI as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ralfebert.
ralfebert/KeyboardAwareSwiftUI 0.5.0
A Swift package that adds a modifier .keyboardAware() to SwiftUI views to handle the keyboard appearing.
⭐️ 25
🕓 3 years ago
iOS
.package(url: "https://github.com/ralfebert/KeyboardAwareSwiftUI.git", from: "0.5.0")

KeyboardAdaptiveSwiftUI

A Swift package that adds a modifier .keyboardAware() to SwiftUI views to handle the keyboard appearing:

Usage:

struct KeyboardAwareView: View {
    @State var text = "example"

    var body: some View {
        NavigationView {
            ScrollView {
                VStack(alignment: .leading) {
                    ForEach(0 ..< 20) { i in
                        Text("Text \(i):")
                        TextField("Text", text: self.$text)
                            .textFieldStyle(RoundedBorderTextFieldStyle())
                            .padding(.bottom, 10)
                    }
                }
                .padding()
            }
            .keyboardAware()  // <--- the view modifier
            .navigationBarTitle("Keyboard Example")
        }

    }
}

Result:

See also

GitHub

link
Stars: 25
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics