Simple code snippet today that show how to push a UIView
and obtain the same effect of a UINavigationController
as push action, choosing also the side (.fromLeft
/ .fromRight
).
We can do this using the CATransition
animations. Very simple:
func push( view: UIView, side: CATransitionSubtype = .fromRight ) {
let transition = CATransition()
transition.type = CATransitionType.push
transition.subtype = side
self.layer.add(transition, forKey: nil)
self.addSubview(view)
}
Enjoy pushing!
Latest posts by Alberto Pasca (see all)
- Swift – Simple full screen loader - 11 August 2022
- macOS – Disable microphone while typing - 11 April 2022
- iOS – Secure app sensitive information - 25 March 2022