Structure

MKMapRect

A rectangular area on a two-dimensional map projection.

Overview

If you project the curved surface of the globe onto a flat surface, what you get is a two-dimensional version of a map where longitude lines appear to be parallel. Such maps are often used to show the entire surface of the globe all at once. An `MKMapRect` data structure represents a rectangular area as seen on this two-dimensional map.

Topics

Creating a Map Rectangle

`init()`

Initializes the rectangle with an empty region.

`init(origin: MKMapPoint, size: MKMapSize)`

Initializes the map rect with the specified point and size.

`init(MKMapRect)`

Returns the region that corresponds to the specified map rectangle.

Getting Standard Map Rectangles

`static let world: MKMapRect`

The map rectangle that represents the world in the two-dimensional map projection.

Getting the Rectangle Coordinates

`var origin: MKMapPoint`

The origin point of the rectangle.

`var size: MKMapSize`

The width and height of the rectangle, starting from the origin point.

Getting the Boundaries

`var minX: Double`

Returns the minimum x-axis value of the specified rectangle.

`var minY: Double`

Returns the minimum y-axis value of the specified rectangle.

`var midX: Double`

Returns the mid-point along the x-axis of the specified rectangle.

`var midY: Double`

Returns the mid-point along the y-axis of the specified rectangle.

`var maxX: Double`

Returns the maximum x-axis value of the specified rectangle.

`var maxY: Double`

Returns the maximum y-axis value of the specified rectangle.

`var width: Double`

Returns the width of the map rectangle.

`var height: Double`

Returns the height of the map rectangle.

Comparing Rectangles

`var isNull: Bool`

Returns a Boolean indicating whether the specified rectangle is null.

`func MKMapRectEqualToRect(MKMapRect, MKMapRect) -> Bool`

Returns a Boolean value indicating whether the two map rectangles are equal

`var isEmpty: Bool`

Returns a Boolean value indicating whether the specified rectangle has no area.

`var spans180thMeridian: Bool`

Returns a Boolean value that indicates whether the specified map rectangle crosses the 180th meridian.

`var remainder: MKMapRect`

Normalizes the portion of the specified rectangle that lies outside the world map boundaries.

Intersecting the Rectangle

`func contains(MKMapPoint) -> Bool`

Returns a Boolean value indicating whether the specified map point lies within the rectangle.

`func contains(MKMapRect) -> Bool`

Returns Boolean value indicating whether one rectangle contains another.

`func intersects(MKMapRect) -> Bool`

Returns a Boolean value indicating whether two rectangles intersect each other.

Modifying the Rectangle

`func union(MKMapRect) -> MKMapRect`

Returns a rectangle representing the union of the two rectangles.

`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.

Getting a Description of the Rectangle

`func MKStringFromMapRect(MKMapRect) -> String`

Returns a formatted string for the specified map rectangle.

Map Coordinates

`struct MKCoordinateRegion`

A rectangular geographic region centered around a specific latitude and longitude.

`struct MKCoordinateSpan`

The width and height of a map region.

`struct MKMapPoint`

A point on a two-dimensional map projection.

`struct MKMapSize`

Width and height information on a two-dimensional map projection.

`class MKDistanceFormatter`

A utility object that converts between a geographic distance and a string-based expression of that distance.