I want to implement a custom push-transition for a navigation controller.
I first implemented the UINavigationControllerDelegate
where I return an Object of UIViewControllerAnimatedTransitioning
.
In this class, I want to take a snapshot of the destination view in order to animate it. However, for the push-segue, this doesn't work - the snapshot ist empty. [when I pop back, I set afterScreenUpdates = false
and everything works]
guard let fromVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from),
let toVC = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to) else {
return
}
guard let snapshot = toVC.view.snapshotView(afterScreenUpdates: true) else {
return }
// Problem:
// snapshot is an empty view!