A layer that draws a cubic Bezier spline in its coordinate space.
- iOS 3.0+
- macOS 10.6+
- tvOS 9.0+
The shape is composited between the layer's contents and its first sublayer.
The shape will be drawn antialiased, and whenever possible it will be mapped into screen space before being rasterized to preserve resolution independence. However, certain kinds of image processing operations, such as CoreImage filters, applied to the layer or its ancestors may force rasterization in a local coordinate space.
Listing 1 shows how you can build complex, composite paths and display them using a shape layer. In this example, a series of progressively transformed ellipses form a simple flower shape. The shape layer that displays the path has its
fill set to
k which stops the overlapping "petals" from filling with the yellow
Figure 1 shows the resulting shape layer.