One good example is animations. UIView animations are so called “stock” or “low cost” animations. When we need more flexibility we can go one level deeper to layers and use Core Animation instead UIView animations.
To understand more about views and layers let’s see how they differ.
Views have more complex hierarchy layouts. To lay them out on the screen we can use Auto Layout.
They can receive user interactions like taps, pinches, cliks and more.
Working with UIViews happens on the main thread, it means it is using CPU power.
Layers on other hand have simpler hierarchy. That means they are faster to resolve and quicker to draw on the screen.
There is no responder chain overhead unlike with views.
CALayer has no custom logic by default. It means that they are not so flexible and fewer classes to subclass for specific needs.
Layers are drawn directly on the GPU. It happens on a separate thread without burdening the CPU.
Each UIView is backed by CALayer which is one level deeper. Views are being drawn using CPU on the main thread. Drawing layers on other hand is on separate thread using GPU power. When you need more flexibility you can move one level down from UIView by using CALayer capabilities.