             
             // Notify about a reregister
             registeredPreviewingData.onPreviewingContextChange?(newPreviewingContext)
+        }
+    }
+    
+    private func resetPeekState() {
+        peekState = .finished
+        peekGestureRecognizer = nil
+    }
+    
+    private func unbindViewControllerFromParent(
+        viewController: UIViewController,
+        rollback: inout (() -> ())?)
+    {
+        if let navigationController = viewController.navigationController {
+            // (*) If you present a `viewController` in a `peek` mode, 
+            // whereas the `viewController` is already embeded into a `parent` controller 
+            // (i.e.: `UINavigationController` and/or probably `UIPopoverController`),
+            // then `UIKit` will require you to unbind the `viewController` from its `parent`
+            let filteredViewControllers = navigationController.viewControllers.filter { $0 !== viewController }
+            navigationController.viewControllers = filteredViewControllers
+            
+            rollback = {
+                // Return `viewController` back to its `parent`
+                let restoredViewControllers = navigationController.viewControllers + [viewController]
+                navigationController.viewControllers = restoredViewControllers                        
+            }
+        }
+        
+        if viewController.parent != nil {
+            // Probably an unhandled edge case. See (*) for details
+            debugPrint(
+                "The following `peek` may crash your app with `NSInvalidArgumentException` \n"
+                    + "reason: 'Application tried to present modally an active controller ...'. \n"
+                    + "If so, please report an issue at a github repo page"
+            )
+        }
+    }
+    
+    @objc private func onPeekGestureChange(_ sender: UIGestureRecognizer) {
+        // When a user cancels `peek`, gesture recognizer's state is `.ended`
+        // When a user commits `peek`, gesture recognizer's state is `.cancelled`
+        if sender.state == .ended {
+            // Release the `peek` view controller
+            resetPeekState()
         }
     }
 }

    
    @available(iOS 9.0, *)
    private func cancelPeekFor(peekAndPopData: PeekAndPopData) {
        peekState = .finished
        
        guard let viewController = peekAndPopData.peekViewController else {
            return

{
    // MARK: - State
    private var registeredPreviewingDataList = [RegisteredPreviewingData]()
    private var peekState: PeekState = .finished
    
    private weak var peekGestureRecognizer: UIGestureRecognizer? {
        didSet {
            oldValue?.removeTarget(self, action: nil)
            peekGestureRecognizer?.addTarget(self, action: #selector(onPeekGestureChange(_:)))
        }
    }
    
    // MARK: - PeekAndPopUtility
    @available(iOS 9.0, *)
