If you drag the edge of a UIViewController
to begin an interactive pop transition within a UINavigationController
, the UIViewController
un
Swift 3:
func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
transitionCoordinator?.notifyWhenInteractionEnds { context in
guard context.isCancelled, let fromViewController = context.viewController(forKey: UITransitionContextViewControllerKey.from) else { return }
self.navigationController(self, willShow: fromViewController, animated: animated)
let animationCompletion: TimeInterval = context.transitionDuration * Double(context.percentComplete)
DispatchQueue.main.asyncAfter(deadline: .now() + animationCompletion) {
self.navigationController(self, didShow: fromViewController, animated: animated)
}
}
}