From ed157286fbdd45a2776a9f49106f578ec34a2720 Mon Sep 17 00:00:00 2001 From: yoloabdo Date: Wed, 8 Nov 2017 10:08:18 +0200 Subject: [PATCH] dismiss issue fix --- Sources/StereoViewController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/StereoViewController.swift b/Sources/StereoViewController.swift index 71cb12a..648ca86 100644 --- a/Sources/StereoViewController.swift +++ b/Sources/StereoViewController.swift @@ -231,7 +231,10 @@ open class StereoViewController: UIViewController, SceneLoadable { if let handler = closeButtonHandler { handler(sender) } else if sender.allTargets.count == 1 { - presentingViewController?.dismiss(animated: true, completion: nil) + // dismiss it from naviagation if it's presented from it, otherwise dismiss modally + if navigationController?.popViewController(animated: true) == nil { + dismiss(animated: true, completion: nil) + } } }