Implementing layers in Swift