How to generate video with animation using swift

Wrote a transition code for some images. It can show image one by one. But I want to create a video with this kind of animations (Zoom in, Zoom out etc). How can I achieve this.

UIView.transition(with: self.imageView,
                          duration: 2.0,
                          options: .transitionCrossDissolve,
                          animations: {
                            self.imageView.image = UIImage(imageLiteralResourceName: 
"image2") 
        }, completion: nil)