Instance Method

union(_:)

Returns a rectangle representing the union of the two rectangles.

Declaration

func union(_ rect2: MKMapRect) -> MKMapRect

Parameters

rect1

The first rectangle.

rect2

The second rectangle.

Return Value

A rectangle whose area encompasses the two rectangles and the space between them.

Discussion

If either rectangle is null, this method returns the other rectangle. The origin point of the returned rectangle is set to the smaller of the x and y values for the two rectangles. Similarly, the size and width of the rectangle are computed by taking the maximum x and y values and subtracting the x and y values for the new origin point.

See Also

Modifying the Rectangle

func intersection(MKMapRect) -> MKMapRect

Returns the rectangle representing the intersection of two rectangles.

func insetBy(dx: Double, dy: Double) -> MKMapRect

Returns the specified rectangle inset by the specified amounts.

func offsetBy(dx: Double, dy: Double) -> MKMapRect

Returns a rectangle whose origin point is shifted by the specified amount.