Group Group Group Group Group Group Group Group Group

Chapter 18: UINavigationController Custom Transition Animations

hello in this chapter of the book there is something I can’t understand:
let maskLayer: CAShapeLayer = RWLogoLayer.logoLayer()
maskLayer.position = fromVC.logo.position
toVC.view.layer.mask = maskLayer
maskLayer.add(animation, forKey: nil)
fromVC.logo.add(animation, forKey: nil)
why we added the animation to the mask ? I know it doesn’t work well otherwise but why?

Hello and welcome to the forum @bakoabdullah! From my understanding of this is that CAShapeLayer inherits from CALayer which is part of the Core Animation framework. Using CAShapeLayer is great for performance since Core Animation is doing the heavy lifting for the animation to look crisp on every device. And because you are using CAShapeLayer it can handle drawing path-based shapes. Hope this helps.

Best,
Gina

This topic was automatically closed after 166 days. New replies are no longer allowed.