Instance Method


Returns whether the first rectangle contains the second rectangle.


func contains(_ rect2: CGRect) -> Bool



The rectangle to test for containment within this rectangle.

Return Value

true if the rectangle specified by rect2 is contained in the rectangle passed in rect1; otherwise, false. The first rectangle contains the second if the union of the two rectangles is equal to the first rectangle.

See Also

Checking Characteristics

func intersects(CGRect) -> Bool

Returns whether two rectangles intersect.

func contains(CGPoint) -> Bool

Returns whether a rectangle contains a specified point.

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