One Logo Pool Ball
_MapKit_SwiftUI · IOS API REFERENCE

MapCameraPosition

struct · iOS 17.0+ · SDK 27.1

struct MapCameraPosition

How to position the map's camera within the map. `MapCameraPosition` contains a number of semantic framings, such as `.automatic` (which frames the content of the map), as well as the `camera` case, which allows you to specify an explicit camera position. When passed as a binding to a map, the map will adjust its camera to frame the requested content, or to exactly match the camera specified. If the `Map` is interacted with by a user in a way that moves the map, the map will reset the position to a value that specifies `positionedByUser`.

Members (15)

get · iOS 17.0+

fallbackPosition

TypeScript
get fallbackPosition(): (MapCameraPosition) | null
Swift declaration
var fallbackPosition: MapCameraPosition? { get }

Returns a non-nil position if this camera position has a fallback position.

static · iOS 17.0+

userLocation

TypeScript
static userLocation(followsHeading: boolean, fallback: MapCameraPosition): MapCameraPosition
Swift declaration
static func userLocation(followsHeading: Bool = false, fallback: MapCameraPosition) -> MapCameraPosition

Creates a position that frames the user's location. - Parameters: - followsHeading: If the camera should rotate to match the heading. of the user. - fallback: The position to use if the user's location hasn't yet been resolved.

get · iOS 17.0+

positionedByUser

TypeScript
get positionedByUser(): boolean
Swift declaration
var positionedByUser: Bool { get }

Returns `true` if the user has positioned the camera.

get · iOS 17.0+

followsUserHeading

TypeScript
get followsUserHeading(): boolean
Swift declaration
var followsUserHeading: Bool { get }

Returns `true` if the map is following the user's heading.

get · iOS 17.0+

followsUserLocation

TypeScript
get followsUserLocation(): boolean
Swift declaration
var followsUserLocation: Bool { get }

Returns `true` if the map is following the user's location.

get · iOS 17.0+

allowsAutomaticPitch

TypeScript
get allowsAutomaticPitch(): boolean
Swift declaration
var allowsAutomaticPitch: Bool { get }

Returns `true` if this camera position allows automatic pitch.

get · iOS 17.0+

item

TypeScript
get item(): (_MapKit_MKMapItem) | null
Swift declaration
var item: MKMapItem? { get }

The item the map is framing if the map is framing an item, otherwise nil.

static · iOS 17.0+

item

TypeScript
static itemAllowsAutomaticPitch(item: _MapKit_MKMapItem, allowsAutomaticPitch?: boolean): MapCameraPosition
Swift declaration
static func item(_ item: MKMapItem, allowsAutomaticPitch: Bool = true) -> MapCameraPosition

Creates a position that frames the given map item. - Parameters: - item: The item to frame. - allowsAutomaticPitch: If the map's camera may use pitch in framing the item.

get · iOS 17.0+

rect

TypeScript
get rect(): (_MapKit_MKMapRect) | null
Swift declaration
var rect: MKMapRect? { get }

The rect the map is framing if the map is framing a rect, otherwise nil.

static · iOS 17.0+

rect

TypeScript
static rect21034(rect: _MapKit_MKMapRect): MapCameraPosition
Swift declaration
static func rect(_ rect: MKMapRect) -> MapCameraPosition

Creates a position that frames the given map rect. - Parameter rect: The map rect to frame.

get · iOS 17.0+

camera

TypeScript
get camera(): (MapCamera) | null
Swift declaration
var camera: MapCamera? { get }

The camera if the position represents an explicit camera, otherwise nil.

static · iOS 17.0+

camera

TypeScript
static camera3160(camera: MapCamera): MapCameraPosition
Swift declaration
static func camera(_ camera: MapCamera) -> MapCameraPosition

Creates a position using an explicit MapCamera.

get · iOS 17.0+

region

TypeScript
get region(): (_MapKit_MKCoordinateRegion) | null
Swift declaration
var region: MKCoordinateRegion? { get }

The region the map is framing if the map is framing a region, otherwise nil.

static · iOS 17.0+

region

TypeScript
static region99780(region: _MapKit_MKCoordinateRegion): MapCameraPosition
Swift declaration
static func region(_ region: MKCoordinateRegion) -> MapCameraPosition

Creates a position that frames the given coordinate region. - Parameter region: The coordinate region to frame.

get · iOS 17.0+

automatic

TypeScript
static get automatic(): MapCameraPosition
Swift declaration
static var automatic: MapCameraPosition { get }

Create a position that frames the map's content.

Skipped declarations

No declarations were skipped in this snapshot.

All _MapKit_SwiftUI types →