MessageKit Version:
13.2
iOS Version(s):
11.3
Swift Version:
4.1
Devices/Simulators:
Both
Reproducible in ChatExample? (Yes/No):
Yes, if you add these lines to handleTyping (just using it as an injection point):
@objc func handleTyping() {
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Dismiss", style: .default, handler: nil))
present(alert, animated: true, completion: nil)
...
}
The MessageInputBar animates down offscreen when the alert is presented. It comes back after the alert is dismissed.
The alert to be presented and the MessageInputBar to remain visible.
This is happening because messageInputBar is the inputAccessoryView on MessagesViewController and is the correct behavior in UIKit.
My question is how do I prevent the MessageInputBar from disappearing when the alert is presented? I've tried overriding some of the first responder properties to prevent the input bar from being "dismissed" but nothing seems to be working quite yet. Is anyone aware of a solution?

Hmm, the embedded gif isn't working. https://giphy.com/gifs/2t9oMHhOAX7E75sNny
@clayellis I'm not sure if this is possible. The MessageInputBar is the inputAccessoryView of the controller 馃
@SD10 right, which is why it isn't a "bug", it's supposed to work that way. I just don't know the fine details of what occurs in the first responder chain when a controller is presented from a controller who is currently the first responder. The closest I've come to achieving the behavior I'm looking for is calling becomeFirstResponder on the MessagesViewController in the presentation completion handler:
present(alert, animated: true, completion: { self.becomeFirstResponder() })
But things just get weird from that point. It isn't a good solution.
Other things I've tried:
UIAlertController and overriding canBecomeFirstResponder and returning false.disablesAutomaticKeyboardDismissal and return false in the MessagesViewController.This SO question doesn't have any answers, but leaving a link to it here just in case at some point in the future someone answers or has the same question: https://stackoverflow.com/questions/46996251/inputaccessoryview-animating-down-when-alertcontroller-actionsheet-presented
The trick is to present the alert from the topmost window and viewcontroller.
let topViewController = UIApplication.shared.windows.last!.rootViewController!
topViewController.present(alert, animated: true, completion: nil)
You could also try creating a new UIWindow above the Keyboard by giving it a higher WindowLevel and present the alert there. I suspect that's what Messages is probably doing since the previous is a bit clunky.

@cwalo That'd do the trick! I was going to use another window as a last resort, but it does seem to be a pretty clean solution! Thanks a ton, I really appreciate it.
Most helpful comment
The trick is to present the alert from the topmost window and viewcontroller.
You could also try creating a new UIWindow above the Keyboard by giving it a higher WindowLevel and present the alert there. I suspect that's what Messages is probably doing since the previous is a bit clunky.