Can a single CALayer be used as the mask for multiple other layers?
I can't find anything in the docs that indicates whether a single CALayer (or subclass) can be used as the mask property for multiple other layers. Is it possible? Or undefined? My experimentation says that it cannot. It will end up as the mask for the last layer it is attached to, and any previous layers it was assigned as a mask to, will revert to the default value of mask. It is possible. I combined mask of CAGradationLayer and CAShapeLayer. I made UIImage from two layers, and I use it to mask. You can generate image from CALayer like below. extension CALayer { func makeImage() -> UIImage {