Member-only story
CALayers: A Guide For Swift
CALayers: A guide
Before we start
This is an easy guide, intended to go into detail about CALayers and even something about the performance of the same.
Oh, you might also be interested in this article
Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 12.2, and Swift 5.3
Keywords and Terminology
CALayer: A layer manages images and allows you to perform animations on those images
CAShapeLayer: A layer that draws a cubic Bezier spline in its coordinate space
CATextLayer: A layer that provides simple text layout and rendering of plain or attributed strings
UIView: An object that manages the content for a rectangular area on the screen
The Repo
I’ve prepared a Repo which should help you follow along with this article!
The Theory
Within a view, a backing layer is used to process bitmap information about those views. Therefore UIView
instances have a root CALayer
, and a programmer can add further layers to a particular UIView
instance and these are actually sublayers of the root…