Structures
The following structures are available globally.
-
The map camera position and orientation.
Usage with the map:
// Usage with an initial camera configuration Map( initialCamera: Camera(center: LatLngAltitude(latitude: 37.7749, longitude: -122.4194, altitude: 0)), mode: .hybrid ) // Usage with a camera binding @State private var camera = Camera(center: LatLngAltitude(latitude: 37.7749, longitude: -122.4194, altitude: 0)) Map(camera: $camera, mode: .hybrid)Usage with fly animations:
struct FlyAnimationExample: View { @State private var animationTrigger = 0 let targetCamera = Camera(center: LatLngAltitude(latitude: 37.7749, longitude: -122.4194, altitude: 0)) var body: some View { Map(mode: .hybrid) .flyCameraTo(targetCamera, trigger: animationTrigger) .flyCameraAround(targetCamera, trigger: animationTrigger) } }Declaration
Swift
struct Cameraextension Camera : AdditiveArithmetic, Animatable, Copyable, Equatable, Escapable, VectorArithmetic -
Declaration
Swift
@MainActor @preconcurrency struct EitherMapContent<First, Second> where First : MapContent, Second : MapContentextension EitherMapContent : MapContent, Sendable, SendableMetatype, View -
Declaration
Swift
struct LatLngAltitudeextension LatLngAltitude : AdditiveArithmetic, Animatable, Copyable, Equatable, Escapable, Hashable, VectorArithmetic -
Represents a rectangular region on the Earth’s surface defined by latitude and longitude ranges.
Bounds can restrict both longitude and latitude, or can restrict either latitude or longitude only. For latitude-only bounds use longitude range of
(-180.0)...180. For longitude-only bounds use latitude range of-(90)...90`.Declaration
Swift
struct LatLngBounds -
Declaration
Swift
@MainActor @preconcurrency struct LoadingViewextension LoadingView : Sendable, SendableMetatype, View -
Declaration
Swift
@MainActor @preconcurrency struct Mapextension Map : MapAnimatable, Sendable, SendableMetatype, View -
Declaration
Swift
@resultBuilder struct MapContentBuilder -
Declaration
Swift
@MainActor @preconcurrency struct MapContentPair<C0, C1> where C0 : MapContent, C1 : MapContentextension MapContentPair : MapContent, Sendable, SendableMetatype, View -
Constructs map controls.
MapControlsBuilderis used in themapControlsview modifier to allow for a natural, declarative syntax when specifying multiple controls.Declaration
Swift
@resultBuilder struct MapControlsBuilder -
The result of a tap gesture on a map.
Declaration
Swift
struct MapTapInfo -
A 3D marker that can be placed on a map.
Map(mode: .hybrid) { Marker3D(position: .init(latitude: 37.7749, longitude: -122.4194, altitude: 0)) }Declaration
Swift
@MainActor @preconcurrency struct Marker3Dextension Marker3D : MapContent, MapContentAnchorable, MapContentTappable, Sendable, SendableMetatype, View -
A 3D model that can be placed on a map.
Map(mode: .hybrid) { Model( position: .init(latitude: 37.7749, longitude: -122.4194, altitude: 100), url: URL(string: "path/to/your/model.glb")! ) }Declaration
Swift
@MainActor @preconcurrency struct Modelextension Model : MapContent, MapContentTappable, Sendable, SendableMetatype, View -
Declaration
Swift
@MainActor @preconcurrency struct OptionalMapContent<C> where C : MapContentextension OptionalMapContent : MapContent, Sendable, SendableMetatype, View -
Declaration
Swift
struct Orientation3Dextension Orientation3D : Equatable, Hashable -
A SwiftUI view that renders a map pin.
The appearance of the pin, including its background color, border color, scale, and glyph, can be customized using a
Pin.Configurationobject.Pinis used internally byMarker3Ds with the.pinstyle, and as a SwiftUI view with theMarkertype.Examples customizing a
PinforMarker:Marker(position: .init(latitude: 0, longitude: 0)) { Pin(configuration: .init(backgroundColor: .blue, borderColor: .black)) }) Marker(position: .init(latitude: 0, longitude: 0)) { Pin(configuration: .red) })Declaration
Swift
@MainActor @preconcurrency struct Pinextension Pin : Sendable, SendableMetatype, View -
A 3D polygon that can be placed on a map.
Map(mode: .hybrid) { Polygon( path: [ .init(latitude: 37.7749, longitude: -122.4194, altitude: 0), .init(latitude: 37.7740, longitude: -122.4184, altitude: 0), .init(latitude: 37.7750, longitude: -122.4174, altitude: 0), ] ) }Declaration
Swift
@MainActor @preconcurrency struct Polygonextension Polygon : MapContent, MapContentTappable, Sendable, SendableMetatype, View -
Represents the geometry definition for a polygon with an outer boundary and optional inner boundaries.
Map(mode: .hybrid) { Polygon( geometry: PolygonGeometry(path: [ .init(latitude: 37.7749, longitude: -122.4194, altitude: 100), .init(latitude: 37.7750, longitude: -122.4193, altitude: 100), .init(latitude: 37.7751, longitude: -122.4192, altitude: 100), ]) ) }Declaration
Swift
struct PolygonGeometryextension PolygonGeometry : Equatable, Hashable -
A 3D polyline that can be placed on a map.
Map(mode: .hybrid) { Polyline(path: [ .init(latitude: 37.7749, longitude: -122.4194, altitude: 100), .init(latitude: 37.7750, longitude: -122.4193, altitude: 100), .init(latitude: 37.7751, longitude: -122.4192, altitude: 100), ]) }Declaration
Swift
@MainActor @preconcurrency struct Polylineextension Polyline : MapContent, MapContentTappable, Sendable, SendableMetatype, View -
A SwiftUI view that displays content in a “popover” bubble, anchored to a position or another piece of map content on the 3D map.
Declaration
Swift
@MainActor @preconcurrency struct Popover<Content> where Content : Viewextension Popover : MapContent, Sendable, SendableMetatype, View -
Configuration for the visual appearance of a Popover.
Declaration
Swift
struct PopoverStyleextension PopoverStyle : Equatable -
Configuration for the shadow of a Popover.
Declaration
Swift
struct Shadowextension Shadow : Equatable -
Declaration
Swift
struct Vector3Dextension Vector3D : Equatable, Hashable