func viewContollerAllDismiss(dismissComplete: @escaping ()->Void) {
        var initialPresentingViewController = self.viewController?.presentingViewController
        while let previousPresentingViewController = initialPresentingViewController?.presentingViewController {
            initialPresentingViewController = previousPresentingViewController
        }
        
        if let snapshot = self.snapshotView(afterScreenUpdates: true) {
            initialPresentingViewController?.presentedViewController?.view.addSubview(snapshot)
        }
        
        initialPresentingViewController?.dismiss(animated: true, completion: {
            dismissComplete()
        })
 }

+ Recent posts