user3255746 user3255746 - 1 year ago 140
Swift Question

Dismiss Messages View Controller

I have an iMessage Extension in swift that is in expanded presentationStlye when a user taps a button. Once this button is tapped, it should dismiss the view entirely or at least return to compact mode. I am not sure what is wrong. Here is didTransition being called from my button:

self.didTransition(to: MSMessagesAppPresentationStyle.compact)

and the action:

override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) {

guard presentationStyle == .expanded else { return }
self.dismiss(animated: true) {


But this is not working. Does anyone know what I am doing wrong?

Answer Source

Actually the right func to call is that one :


You can call it like this in your MSMessageAppViewController :


You don't need to override anything ;) Hope this will help you!

Note: have a look to the documentation here:

It will help you a lot!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download