. swift4.
install pod file.
pod 'IQKeyboardManager'
IQKeyboardManager AppDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
IQKeyboardManager.shared().isEnabled = true
return true
}