Instance Method

intersects(_:)

Returns whether two rectangles intersect.

Declaration

func intersects(_ rect2: CGRect) -> Bool

Parameters

rect2

The rectangle to test for intersection with this rectangle.

Return Value

true if the two specified rectangles intersect; otherwise, false. The first rectangle intersects the second if the intersection of the rectangles is not equal to the null rectangle.

See Also

Checking Characteristics

func contains(CGPoint) -> Bool

Returns whether a rectangle contains a specified point.

func contains(CGRect) -> Bool

Returns whether the first rectangle contains the second rectangle.

var isEmpty: Bool

Returns whether a rectangle has zero width or height, or is a null rectangle.

var isInfinite: Bool

Returns whether a rectangle is infinite.

var isNull: Bool

Returns whether the rectangle is equal to the null rectangle.

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