keyboardWillShow will only work from the second time on

I have a UITextView that I need to move up when the user focuses on it.

In the simulator I have set up 2 keyboards (English,Greek)

  • GCD: How to remove waiting tasks from serial queue?
  • Switching to a TabBar tab view programmatically?
  • TDD iOS tutorial
  • Xcode 9 Swift Language Version (SWIFT_VERSION)
  • string replace phone number iOS swift
  • What happens to older clients when you migrate an app server from GCM to FCM?
  • Within keyboardWillShow function I change the UITextView’s height to be less than the existing one, as in

    self.page_text.frame = CGRectMake(self.page_text.frame.origin.x, self.page_text.frame.origin.y, self.page_text.frame.width, (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as NSValue).CGRectValue().origin.y - 180)

    The problem is that only each first time I focus on the text view the keyboard appears but the UITextView’s height does not change:

    first keyboard appearance

    After that first time, each time I change the keyboard’s language the text view behaves as expected.

    second time appearance

    Why could this be happening?

    The project can be found here

    PS: I noticed that if the two keyboards are in the same language (ex US English and UK English), the height never changes. How strange is that?