Instance Method

contains(_:)

Returns whether the first rectangle contains the second rectangle.

Declaration

func contains(_ rect2: CGRect) -> Bool

Parameters

rect2

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.