O'Reilly logo

Swift Essentials - Second Edition by Dr. Alex Blewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Custom graphics with layers

Drawing graphics by overriding drawRect is not very performant because all the drawing routines are executed on the CPU. Offloading the graphics drawing to the GPU is both more performant and more power efficient.

iOS has a concept of layers, which are Core Graphics optimized drawing contents. Operations composed on a layer, including adding a path, can be translated into code that can execute on the GPU and be rendered efficiently. In addition, Core Animation can be used to animate changes on layers efficiently. Core Animation is provided in the QuartzCore framework/module; the two terms are interchangeable. It is more generally known as Core Animation.

The download progress icon on iOS can be recreated as a ProgressView ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required