Skip to content

Instantly share code, notes, and snippets.

@mwrites
Last active February 1, 2017 17:46
Show Gist options
  • Save mwrites/8d68a5009e5f591416c9c281e8de0176 to your computer and use it in GitHub Desktop.
Save mwrites/8d68a5009e5f591416c9c281e8de0176 to your computer and use it in GitHub Desktop.
dismiss two modal without showing first modal background
extension UIViewController {
func dismissModal(animated: Bool = true, completion: (()->Void)? = nil) {
if let snapshot = UIApplication.shared.delegate?.window??.snapshotView(afterScreenUpdates: false) {
self.presentedViewController?.view.addSubview(snapshot)
}
self.dismiss(animated: animated, completion: completion)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment