I search a lot about it on stack overflow but according to their solution my program is same as mention but still not working.
func subscribeToKeyboardNotifications() {
NotificationCenter.default.addObserver(self, selector:Selector(("keyboardWillShow:")), name:NSNotification.Name.UIKeyboardWillShow, object: nil)
}
func keyboardWillShow(notification:NSNotification) {
view.frame.origin.y -= getKeyboardHeight(notification: notification)
}