swift dismiss 2 view controllers code example
Example 1: dismiss two view controllers at once swift
if let first = presentingViewController,
let second = first.presentingViewController{
first.view.isHidden = true
second.dismiss(animated: true)
}
Example 2: dismiss two view controllers at once swift
self.presentingViewController?.presentingViewController?.dismiss(animated: true, completion: nil)