GoogleMaps3D Framework Reference

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 Camera
    extension Camera : AdditiveArithmetic, Animatable, Copyable, Equatable, Escapable, VectorArithmetic
  • Declaration

    Swift

    @MainActor
    @preconcurrency
    struct EitherMapContent<First, Second> where First : MapContent, Second : MapContent
    extension EitherMapContent : MapContent, Sendable, SendableMetatype, View
  • Declaration

    Swift

    struct LatLngAltitude
    extension 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 LoadingView
    extension LoadingView : Sendable, SendableMetatype, View
  • Map

    Declaration

    Swift

    @MainActor
    @preconcurrency
    struct Map
    extension Map : MapAnimatable, Sendable, SendableMetatype, View
  • Declaration

    Swift

    @resultBuilder
    struct MapContentBuilder
  • Declaration

    Swift

    @MainActor
    @preconcurrency
    struct MapContentPair<C0, C1> where C0 : MapContent, C1 : MapContent
    extension MapContentPair : MapContent, Sendable, SendableMetatype, View
  • Constructs map controls.

    MapControlsBuilder is used in the mapControls view 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 Marker3D
    extension 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 Model
    extension Model : MapContent, MapContentTappable, Sendable, SendableMetatype, View
  • Declaration

    Swift

    @MainActor
    @preconcurrency
    struct OptionalMapContent<C> where C : MapContent
    extension OptionalMapContent : MapContent, Sendable, SendableMetatype, View
  • Declaration

    Swift

    struct Orientation3D
    extension Orientation3D : Equatable, Hashable
  • Pin

    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.Configuration object.

    Pin is used internally by Marker3Ds with the .pin style, and as a SwiftUI view with the Marker type.

    Examples customizing a Pin for Marker:

    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 Pin
    extension 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 Polygon
    extension 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 PolygonGeometry
    extension 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 Polyline
    extension 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 : View
    extension Popover : MapContent, Sendable, SendableMetatype, View
  • Configuration for the visual appearance of a Popover.

    Declaration

    Swift

    struct PopoverStyle
    extension PopoverStyle : Equatable
  • Configuration for the shadow of a Popover.

    Declaration

    Swift

    struct Shadow
    extension Shadow : Equatable
  • Declaration

    Swift

    struct Vector3D
    extension Vector3D : Equatable, Hashable