Dismissing Modal Presentations

Dismiss Delegate

For modal presentations, conforming to DismissDelegate is optional, but allows custom handling of the dismissing of SDK controllers. It is recommended, but not required, to conform to the delegate. Passing nil will have the SDK dismiss controllers automatically.

Basic implementation looks like this, provided the SDK controller has been presented from the navigation controller:

extension MyViewController: DismissDelegate {
    public func shouldDismiss(viewController: UIViewController) {
        navigationController?.dismiss(animated: true, completion: nil)
    }
}

Updated: