keyboardWillShowNotification how to get the correct frame?

I can't get the height of the keyboard inside the app in Stage Manager mode. The frame of the red area is what I want to know (see picture for details).

Replies

Anyway. I can get the correct height now.

let end = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
let begin = (userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue
let height = begin.origin.y - end.origin.y