Chaining Animations iOS UI
We all agree that animations bring life to apps. One of my favorite animations is the CHAINS which you start a new animation immediately after the current animation.
https://www.youtube.com/watch?time_continue=3&v=kO5NdeC0m1Q
Let’s See how this animation work.

We have simple UI here which contains of Background Image, one button and 2 labels
We are gonna make the first label animate then the second label then the Button.
First of all we will connect the Outlets to our ViewController.

and then we make the alpha of the objects we wanna animate = 0

So Let’s bring some magic and see how this little animations can make our app more cool.
first of all we are gonna animate the backgroundImage
so we will use the UIView.animate function with a completion handler.

So this code will make the alpha of the background Image = 0.6 but we put this line of code inside the UIView.animate Function which will make it change during 0.5 second.
After the imageView will be shown, we need to show the Title Label. So we put some code inside the completion handler of the UIView.animate Which is a function “showTitle” which we will create right now.

In this function we do the same we’ve done the background image.
We have simply make the alpha of the title label = 1. this line of code will show the title label with nice animation.
And the same happens here, after the titleLabel will be shown, we need to show the descriptionLabel. So we put some code inside the completion handler of the UIView.animate Which is a function “showDescription” which we will create right now.

in this function we also make the alpha of the descriptionLabel = 1. which will show the descriptionLabel with little animation. and we will do the same we’ve done before.
Finally we need to show the go button so we put the code who will show it inside the completion handler of the UIView.animate Which is a function “showGoButton” which we will create right now.

in this function we just will show the go button with no need to use the completion handler here. because it will be the last object to show in our chaining animations.
The last thing we need to implement is to call the first function we made in the viewDidaAppear function to start our Chaining Animations.

That’s all we need to make this cool animation happen.
You Can Download the demo code from here