Map
@MainActor
@preconcurrency
struct Mapextension Map : MapAnimatable, Sendable, 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.propertyproperty.Declaration
Swift
@available(watchOS, introduced: 6.0) @available(macOS, introduced: 10.15) @available(iOS, introduced: 13.0) @available(tvOS, introduced: 13.0) 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
bodyproperty 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 } -
Declaration
Swift
@MainActor @preconcurrency var coordinator: RenderingCoordinator -
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
Parameters
cameraThe camera position and orientation binding, defining the map’s viewport.
modeThe desired map mode (e.g.,
.hybrid,.satellite).contentThe 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
Parameters
initialCameraThe 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}.
modeThe desired map mode (e.g.,
.hybrid,.satellite).contentThe content to be displayed on the map. This parameter is optional;