目录

KeyboardHost

This project is only for SwiftUI

When View uses ignoresSafeArea or edgesIgnoringSafeArea(.bottom)

this framework can be used because TextField and TextEditor cannot make the keyboard bounce

Encapsulated UITextView, UITextField can also be used

Supported Platforms

  • iOS 13.0
  • macOS 10.15
  • tvOS 13.0
  • watchOS 6.0

Usage

    @State private var text: String = ""
    
    var body: some View {
        VStack {
            Spacer()
            KeyboardHost {
                TextField("please enter text", text: $text)
                    .frame(width: 200, height: 40, alignment: .center)
                    .padding(.bottom, 20)
            }
        }
        .ignoresSafeArea()
    }

Installation

You can add KeyboardHost to an Xcode project by adding it as a package dependency.

  1. From the File menu, select Swift PackagesAdd Package Dependency…
  2. Enter https://github.com/HumorousGhost/KeyboardHost into the package repository URL text field
  3. Link KeyboardHost to your application target
关于
33.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号