I actually figured out a simple way to perform this animation. There might be better ways to do this, but just incase someone needs help in future.
We write 2 functions for zoomIn and zoomOut (can be used anywhere)
func zoomOut(view : UIView,duration : Double,delay : Double)
{
UIView.animate(withDuration: duration, delay: delay, options: UIView.AnimationOptions.curveEaseIn, animations: {
view.transform = CGAffineTransform.identity.scaledBy(x: 0.95, y: 0.95)
})
}
func zoomIn(view : UIView,duration : Double,delay : Double)
{
UIView.animate(withDuration: duration, delay: delay, options: UIView.AnimationOptions.curveEaseIn, animations: {
view.transform = CGAffineTransform.identity
})
}
Then we write functions for movement (Can be used anywhere)
func movementAnimation(duration:Double,X:CGFloat,Y:CGFloat,item:UIView)
{
UIView.animate(withDuration: duration) {
item.transform = CGAffineTransform(translationX: X, y: Y)
}
}
and finally we combine these 2 to get a similar animation !
zoomOut(view: Table, duration: 0.1, delay: 0)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
movementAnimation(duration: 0.2, X: -500, Y: 0, item: self.Table)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
movementAnimation(duration: 0, X: 500, Y: 0, item: self.Table)
movementAnimation(duration: 0.2, X: 0, Y: 0, item: self.Table)
}
zoomIn(view: self.Table, duration: 0.1, delay: 0.6)
Here first the view is zoomedOut (reduce scale to 0.95) then its moved outside scree with 0.2sec duration.Once its outside screen, its immediately moved to right side of the screen with 0sec duration. Then with a 0.2sec duration we move it back to original position. Now we call zoomIn to get the view back to its original size with a duration of 0.1sec. The 0.5sec is the total amount of time taken for the zoomOut + movementOut + movementIn functions.
And finally reloading the Table
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
self.Table.reloadData()
}
Hope this helps someone and thx to 'Nikunj Kumbhani' for the pod idea!