Master UIView Animation

Making things look nice in Swift’s UIKit

Steven Curtis
5 min readMay 20, 2020
Photo by Tamara Bellis on Unsplash

Animation is one of those potential blind spots for iOS developers, and is one I’ve touched on before. However, there is plenty of fun to have here, so get started with this article!

Difficulty: Beginner | Easy | Normal | Challenging

Prerequisites:

Terminology

UIView: An object that manages the content for a rectangular area on the screen

The Demo

The setup

I’ve used Playgrounds with the UI to create a UIViewController that will hold my animations. What will they look like? Here is the finished product (shudder).

Where should animations take place? The most canonical, sensible answer is within your viewDidAppear(_:) since the frames of the subview are set, and you don’t want your nice animation to take place where and when the user can’t see it (do you?)

This gives us the following shell App

--

--