Instance Method


Returns the farthest descendant of the receiver in the layer hierarchy (including itself) that contains the specified point.


func hitTest(_ p: CGPoint) -> CALayer?



A point in the coordinate system of the receiver's superlayer.

Return Value

The layer that contains thePoint or nil if the point lies outside the receiver’s bounds rectangle.

See Also

Hit Testing

func contains(CGPoint) -> Bool

Returns whether the receiver contains a specified point.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software