Contents

william-weng/wwkeyboardshadowview

[Introduction - 簡介](https://swiftpackageindex.com/William-Weng)

Installation with Swift Package Manager

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

可用函式

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

Delegate

|函式|說明| |-|-| |keyboardViewChange(:status:information:)|鍵盤View的顯示狀態 / 可不可以改變| |keyboardView(:error:)|錯誤提示|

Example

import UIKit
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: WWKeyboardShadowView.Delegate {
    
    func keyboardViewChange(_ view: WWKeyboardShadowView, status: WWKeyboardShadowView.DisplayStatus, information: WWKeyboardShadowView.KeyboardInformation, height: CGFloat) -> Bool {
        return true
    }
    
    func keyboardView(_ view: WWKeyboardShadowView, error: WWKeyboardShadowView.CustomError) {
        print(error)
    }
}

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

Package Metadata

Repository: william-weng/wwkeyboardshadowview

Default branch: main

README: README.md