Master UIView Animation
Making things look nice in Swift’s UIKit
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:
- You can use a Single View Application or Playgrounds application showing the view controller. In either case Auto Layout is a big part of this. Tutorials? Playgrounds with the UI and Single View Application and Auto Layout.
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