Skip to main content

Posts

Showing posts from September, 2017

CALayer Tutorial for iOS: Getting Started

Update note:  This tutorial has been updated to iOS 11, Swift 4, and Xcode 9 by  Michael Ciurus . The original tutorial was written by  Scott Gardner . As you probably know, everything you see in an iOS app is a view. There’s button views, table views, slider views, and even parent views that contain other views. But what you might not know is that each view in iOS is backed by another class called a layer – a  CALayer  to be specific. In this article, you’ll learn what a  CALayer  is and how it works. You’ll also see 10 examples of using  CALayer s for cool effects, like shapes, gradients, and even particle systems. This article assumes you’re familiar with the basics of iOS app development and Swift, including constructing your UI with storyboards. Note : If you’re not quite there, no worries. You’ll be happy to know we have quite a few tutorials and books on the subject, such as  Learn to Code iOS Apps with Swift  and  The iOS Apprentice . How does CALayer relate to