Contents

intersects(_:)

Returns a Boolean value that indicates whether two rectangles intersect each other.

Declaration

func intersects(_ rect2: MKMapRect) -> Bool

Parameters

  • rect2:

    The second rectangle.

Return Value

true if rect1 and rect2 intersect each other, or false if they don’t intersect or either rectangle is null.

Discussion

The rectangles aren’t intersecting if the only intersection occurs along an edge. For a true intersection, the rectangles both need to enclose a single rectangular area with a width and height that are both greater than 0.

See Also

Intersecting the rectangle