SwiftKickMobile/SwiftMessages

why didHide Source dismiss?

Closed this issue · 3 comments

source.dismiss(animated: false, completion: nil)

This line of code causes my original page to disappear. When I call SwiftMessage from the presented page, it causes issues.

Maybe change to presented.dismiss()?

let segue = SwiftMessagesSegue(identifier: String(describing: vc.self), source: self, destination: vc) segue.configure(layout: .bottomMessage) segue.dimMode = .gray(interactive: true) segue.perform()
The self is a model viewcontroller,when I tap dismiss the vc, self will be dismiss, too.So I so confuse the code "source.dismiss(animated: false, completion: nil)" in SwiftMessagesSegue.swift

@LiuYimin I think you need to review Apple's API documentation:

dismiss(animated:completion:)
Dismisses the view controller that was presented modally by the view controller.

https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismiss

So source.dismiss(animated: false, completion: nil) is correct.

Thank you very much. I've resolved the issue, and it wasn't because of this "source" (although changing "source" to "presented" could also solve my problem), but rather because when using SwiftMessage in a view controller presented using the .overCurrentContext style from a child view controller, the "source" would also dismiss my own view controller.