Swiftpack.co - Package - CoreKit/KeyboardAvoiding

CoreKit KeyboardAvoiding

Watch out ! We've got a keyboard here!

Installation

Swift Package Manager

.package(url: "https://github.com/CoreKit/KeyboardAvoiding", from: "1.0.0"),

Usage

import UIKit
import KeyboardAvoiding

class ViewController: UIViewController {

    private var keyboardAvoiding: KeyboardAvoiding!

    override func viewDidLoad() {
        super.viewDidLoad()

        self.keyboardAvoiding = KeyboardAvoiding()
        .onKeyboardWillShow { rect in
            // do your stuff here 
        }
        .onKeyboardDidShow { rect in
            // do your stuff here
        }
        .onKeyboardWillHide {
            // do your stuff here
        }
        .onKeyboardDidHide {
            // do your stuff here
        }
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

        self.keyboardAvoiding.start()
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)

        self.keyboardAvoiding.stop()
    }
}

License

WTFPL - Do what the fuck you want to.

Github

link
Stars: 4

Dependencies

Used By

Total: 0

Releases

Improved notification handlers - 2019-10-16 08:01:32

  • willShow, didShow, willHide, didHide notification handlers
  • removed CocoaPods & Carthage support
  • updated to Swift 5

Public initializer - 2019-02-12 13:43:13

  • added missing public init method

First release - 2019-02-11 14:47:12