GoogleMaps3D Framework Reference

Map

@MainActor
@preconcurrency
struct Map
extension Map : MapAnimatable, Sendable, SendableMetatype, View
  • The type of view representing the body of this view.

    When you create a custom view, Swift infers this type from your implementation of the required View/body-swift.property property.

    Declaration

    Swift

    typealias Body = some View
  • The API key to use for the Google Maps SDK.

    This is required to use the Google Maps SDK.

    Declaration

    Swift

    @MainActor
    @preconcurrency
    static var apiKey: String { get set }
  • The content and behavior of the view.

    When you implement a custom view, you must implement a computed body property to provide the content for your view. Return a view that’s composed of built-in views that SwiftUI provides, plus other composite views that you’ve already defined:

    struct MyView: View {
        var body: some View {
            Text("Hello, World!")
        }
    }
    

    For more information about composing views and a view hierarchy, see doc:Declaring-a-Custom-View.

    Declaration

    Swift

    @MainActor
    @preconcurrency
    var body: some View { get }
  • Initializes the map view with the specified camera, mode, and content.

    This method configures the map’s initial viewpoint, rendering style, and displayed content.

    Declaration

    Swift

    @MainActor
    @preconcurrency
    init<Content>(camera: Binding<Camera>, mode: MapMode, @MapContentBuilder content: () -> Content = { EmptyMapContent() }) where Content : MapContent

    Parameters

    camera

    The camera position and orientation binding, defining the map’s viewport.

    mode

    The desired map mode (e.g., .hybrid, .satellite).

    content

    The content to be displayed on the map. This parameter is optional;

  • Initializes the map view with the specified camera, mode, and content.

    This method configures the map’s initial viewpoint and rendering style.

    Declaration

    Swift

    @MainActor
    @preconcurrency
    init<Content>(initialCamera: Camera = .init(center: .init(latitude: 0, longitude: 0, altitude: 63_170_000)), mode: MapMode, @MapContentBuilder content: () -> Content = { EmptyMapContent() }) where Content : MapContent

    Parameters

    initialCamera

    The initial camera position and orientation, defining the map’s viewport. Defaults to a global view at {latitude: 0, longitude: 0, altitude: 63,170,000 meters}.

    mode

    The desired map mode (e.g., .hybrid, .satellite).

    content

    The content to be displayed on the map. This parameter is optional;

  • Returns the open source license information for the Google Maps SDK.

    Declaration

    Swift

    @MainActor
    @preconcurrency
    static let openSourceLicenseInfo: String
  • Declaration

    Swift

    @MainActor
    var provider: _MapAnimatableProvider
  • Applies a Cloud-based Map Style to the map.

    Use this method to associate a unique Map ID with your map instance. Map IDs are created and managed in the Google Cloud Console. Changing the mapID will trigger a full recreation of the Map view.

    Manage Map Styles

    Declaration

    Swift

    @MainActor
    @preconcurrency
    func style(mapID: String, error: (() -> Void)? = nil) -> Map

    Parameters

    mapID

    The unique Map ID string generated in the Google Cloud Console.

    Return Value

    A map view configured with the specified style.