WWKeyboardShadowView

main

A View that can interact with keyboard events can change simultaneously with the height of the keyboard, simply and effectively solving the problem of the input box being blocked during text input.
William-Weng/WWKeyboardShadowView

WWKeyboardShadowView

Swift-5.6 iOS-14.0 Swift Package Manager-SUCCESS LICENSE

dependencies: [
    .package(url: "https://github.com/William-Weng/WWKeyboardShadowView.git", .upToNextMajor(from: "1.0.0"))
]

可用函式

函式 說明
configure(target:keyboardConstraintHeight:) 設定初始View相關參數
register() 註冊鍵盤事件
unregister() 解除鍵盤事件

Example

import UIKit
import WWPrint
import WWKeyboardShadowView

final class ViewController: UIViewController {
    
    @IBOutlet weak var keyboardShadowView: WWKeyboardShadowView!
    @IBOutlet weak var shadowViewHeightConstraint: NSLayoutConstraint!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        initSetting()
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)
        view.endEditing(true)
    }
}

extension ViewController: WWKeyboardShadowViewDelegate {
    
    func keyboardWillChange(view: WWKeyboardShadowView, information: WWKeyboardShadowView.KeyboardInfomation) -> Bool {
        wwPrint("keyboardWillChange")
        return true
    }
    
    func keyboardDidChange(view: WWKeyboardShadowView) {
        wwPrint("keyboardDidChange")
    }
}

private extension ViewController {
    
    func initSetting() {
        keyboardShadowView.configure(target: self, keyboardConstraintHeight: shadowViewHeightConstraint)
        keyboardShadowView.register()
    }
}

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Apr 15 2024 04:09:43 GMT-0900 (Hawaii-Aleutian Daylight Time)