Post not yet marked as solved
Post marked as unsolved with 1 replies, 2,170 views
Hello,The triggering of the UIView animation completion block following code ends up being slowed down by ~100x instead of ~10x with slow animations enabled in the simulator:import UIKit
class Animator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return 0.175
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let toViewController = transitionContext.viewController(forKey: .to) else {
fatalError("to view controller not found")
}
transitionContext.containerView.addSubview(toViewController.view)
toViewController.view.frame = transitionContext.containerView.frame
toViewController.view.alpha = 0
toViewController.view.transform = CGAffineTransform(scaleX: 1.2, y: 1.2)
let start = Date()
UIView.animate(
withDuration: transitionDuration(using: transitionContext),
animations: {
toViewController.view.alpha = 1
toViewController.view.transform = .identity
},
completion: { finished in
print("animateTransition completion after \(-start.timeIntervalSinceNow)")
transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
})
}
}This results in views not being interactive for a long while when developing with slow transitions on. Completion blocks to calls to UIView animations outside of animateTransition(using transitionContext: UIViewControllerContextTransitioning) are called when expected.Does anyone know why this is?