Easy to use keyboard avoiding library.
.package(url: "https://github.com/CoreKit/KeyboardAvoiding", from: "1.0.0"),
import UIKit
import KeyboardAvoiding
classViewController:UIViewController{privatevarkeyboardAvoiding:KeyboardAvoiding!overridefunc 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
}}overridefunc viewWillAppear(_ animated:Bool){
super.viewWillAppear(animated)self.keyboardAvoiding.start()}overridefunc viewWillDisappear(_ animated:Bool){
super.viewWillDisappear(animated)self.keyboardAvoiding.stop()}}