iOS apps usually utilise lots of smooth animations to make app looks prettier in order to improve overall user experience. Plenty of iOS default widgets have been already implemented with UIKit animations. For example, the animation during transiting between pages in an UINavigationController, presenting a UIViewController and showing the system keyboard, etc. At the same time, Apple opens the UIView animation API for developers to create custom animation easily. Let’s take a brief look how those default animations look like.

Curve and transition animation

Curve animation

There are totally 4 common curve animation options available in UIKit and each of them are different in their own speed at different time frames.

All animations have the same duration — 1.0 second

Here are the corresponding descriptions:

(Skip it if you have already got the main idea from the above graph 😄)

curveEaseIn (Blue)

Although its initial speed is low, it reaches the highest speed at the end under constant acceleration. curveEaseOut (Red)

A horizontal flip of curveEaseIn . curveEaseInOut (Yellow)

A combination of 1st half of curveEaseIn and the 2nd half of curveEaseOut . curveLinear (Green)

With zero acceleration, its speed remains roughly the same throughout the whole animation.

Other curve animation options:

allowUserInteraction

By default, UIView cannot be interacted by user during the animation 😅 ! Luckily, by setting an extra animation option allowUserInteraction together with the original curve animation options, the interaction can be enabled. See below:

2. repeat

Self explanatory. Simply just repeating the original animation infinitely. To stop it:

3. autoreverse