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?
Actually the right func to call is that one :
requestPresentationStyle(MSMessagesAppPresentationStyle)
You can call it like this in your MSMessageAppViewController
:
self.requestPresentationStyle(.compact)
You don't need to override anything ;) Hope this will help you!
Note: have a look to the documentation here: https://developer.apple.com/reference/messages/msmessagesappviewcontroller
It will help you a lot!