GoogleMaps3D Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
View
extension View where Self : MapAnimatable
extension View where Self : MapAnimatable, Trigger : Equatable
-
Applies a set of restrictions to the map’s camera behavior.
Use this modifier to constrain how the user can manipulate the map’s viewpoint,
ensuring it stays within defined altitude, heading, tilt, or geographical bounds.
Applying an empty array removes any existing restrictions.
Map(mode: .hybrid)
.cameraRestrictions([
.altitude(0...10000), // Limit zoom-out altitude
.tilt(0...60) // Limit maximum tilt
])
Note
If the array has more than one restriction of the same type, the last one will be
used.
Declaration
Swift
@MainActor
@preconcurrency
func cameraRestrictions(_ restrictions: [CameraRestriction]) -> Self
Parameters
restrictions
|
An array of CameraRestriction cases defining the
limits to apply to the camera’s movement and orientation.
|
Return Value
The Map
instance, allowing for further modifier chaining.
-
Adds a closure to be called when a place is tapped on the map.
Declaration
Swift
@MainActor
@preconcurrency
func onPlaceTap(_ handler: @escaping ((PlaceTapInfo) -> Void)) -> Self
Parameters
handler
|
A closure that the system calls when a place on the map is tapped.
This closure receives a PlaceTapInfo object containing place identifier and geographic
coordinates.
|
Return Value
A new View
with the tap handler added.
-
Fly the camera around the given center camera with the given duration and rounds.
Declaration
Swift
@MainActor
@preconcurrency
func flyCameraAround<Trigger>(_ camera: Camera, duration: TimeInterval = 2, rounds: Double = 1, trigger: Trigger, callback: (() -> Void)? = nil) -> ModifiedContent<Self, EquatableChangeModifier<Trigger>>
Parameters
camera
|
The center camera to fly around.
|
duration
|
The duration of the animation in seconds.
|
rounds
|
The number of times to fly around the center camera.
|
trigger
|
The trigger to fly the camera.
|
callback
|
The callback to be called when the animation is complete.
|
-
Fly the camera to the given destination camera with the given duration.
Declaration
Swift
@MainActor
@preconcurrency
func flyCameraTo<Trigger>(_ camera: Camera, duration: TimeInterval = 2, trigger: Trigger, completion: (() -> Void)? = nil) -> ModifiedContent<Self, EquatableChangeModifier<Trigger>>
Parameters
camera
|
The destination camera to fly to.
|
duration
|
The duration of the animation in seconds.
|
trigger
|
The trigger to fly the camera.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[],[],null,["# GoogleMaps3D Framework Reference\n\nView\n====\n\n extension View where Self : MapAnimatable\n\n extension View where Self : MapAnimatable, Trigger : Equatable\n\n[Available where \\`Self\\` : \\`MapAnimatable\\`\n--------------------------------------------](#/Available-where-%60Self%60-%3A-%60MapAnimatable%60)\n\n- `\n ``\n ``\n `\n\n ### [cameraRestrictions(_:)](#/s:7SwiftUI4ViewP12GoogleMaps3DAD13MapAnimatableRzrlE18cameraRestrictionsyxSayAD17CameraRestrictionOGF)\n\n `\n ` \n Applies a set of restrictions to the map's camera behavior.\n\n Use this modifier to constrain how the user can manipulate the map's viewpoint,\n ensuring it stays within defined altitude, heading, tilt, or geographical bounds.\n Applying an empty array removes any existing restrictions. \n\n Map(mode: .hybrid)\n .cameraRestrictions([\n .altitude(0...10000), // Limit zoom-out altitude\n .tilt(0...60) // Limit maximum tilt\n ])\n\n Note\n\n If the array has more than one restriction of the same type, the last one will be\n used. \n\n #### Declaration\n\n Swift \n\n @MainActor\n @preconcurrency\n func cameraRestrictions(_ restrictions: [../Enums/CameraRestriction.html]) -\u003e Self\n\n #### Parameters\n\n |----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*restrictions*` ` | An array of [CameraRestriction](../Enums/CameraRestriction.html) cases defining the limits to apply to the camera's movement and orientation. |\n\n #### Return Value\n\n The [Map](../Structs/Map.html) instance, allowing for further modifier chaining.\n- `\n ``\n ``\n `\n\n ### [onPlaceTap(_:)](#/s:7SwiftUI4ViewP12GoogleMaps3DAD13MapAnimatableRzrlE10onPlaceTapyxyAD0iJ4InfoVcF)\n\n `\n ` \n Adds a closure to be called when a place is tapped on the map. \n\n #### Declaration\n\n Swift \n\n @MainActor\n @preconcurrency\n func onPlaceTap(_ handler: @escaping ((../Structs/PlaceTapInfo.html) -\u003e Void)) -\u003e Self\n\n #### Parameters\n\n |-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*handler*` ` | A closure that the system calls when a place on the map is tapped. This closure receives a [PlaceTapInfo](../Structs/PlaceTapInfo.html) object containing place identifier and geographic coordinates. |\n\n #### Return Value\n\nA new `View` with the tap handler added. \n[Available where \\`Self\\` : \\`MapAnimatable\\`, \\`Trigger\\` : \\`Equatable\\`\n-------------------------------------------------------------------------](#/Available-where-%60Self%60-%3A-%60MapAnimatable%60%2C-%60Trigger%60-%3A-%60Equatable%60)\n\n- `\n ``\n ``\n `\n\n ### [flyCameraAround(_:duration:rounds:trigger:callback:)](#/s:7SwiftUI4ViewP12GoogleMaps3DAD13MapAnimatableRzrlE15flyCameraAround_8duration6rounds7trigger8callbackAA15ModifiedContentVyxAD23EquatableChangeModifierVyqd__GGAD0I0V_S2dqd__yycSgtSQRd__lF)\n\n `\n ` \n Fly the camera around the given center camera with the given duration and rounds. \n\n #### Declaration\n\n Swift \n\n @MainActor\n @preconcurrency\n func flyCameraAround\u003cTrigger\u003e(_ camera: ../Structs/Camera.html, duration: TimeInterval = 2, rounds: Double = 1, trigger: Trigger, callback: (() -\u003e Void)? = nil) -\u003e ModifiedContent\u003cSelf, EquatableChangeModifier\u003cTrigger\u003e\u003e\n\n #### Parameters\n\n |------------------|-----------------------------------------------------------|\n | ` `*camera*` ` | The center camera to fly around. |\n | ` `*duration*` ` | The duration of the animation in seconds. |\n | ` `*rounds*` ` | The number of times to fly around the center camera. |\n | ` `*trigger*` ` | The trigger to fly the camera. |\n | ` `*callback*` ` | The callback to be called when the animation is complete. |\n\n- `\n ``\n ``\n `\n\n ### [flyCameraTo(_:duration:trigger:completion:)](#/s:7SwiftUI4ViewP12GoogleMaps3DAD13MapAnimatableRzrlE11flyCameraTo_8duration7trigger10completionAA15ModifiedContentVyxAD23EquatableChangeModifierVyqd__GGAD0I0V_Sdqd__yycSgtSQRd__lF)\n\n `\n ` \n Fly the camera to the given destination camera with the given duration. \n\n #### Declaration\n\n Swift \n\n @MainActor\n @preconcurrency\n func flyCameraTo\u003cTrigger\u003e(_ camera: ../Structs/Camera.html, duration: TimeInterval = 2, trigger: Trigger, completion: (() -\u003e Void)? = nil) -\u003e ModifiedContent\u003cSelf, EquatableChangeModifier\u003cTrigger\u003e\u003e\n\n #### Parameters\n\n |------------------|-------------------------------------------|\n | ` `*camera*` ` | The destination camera to fly to. |\n | ` `*duration*` ` | The duration of the animation in seconds. |\n | ` `*trigger*` ` | The trigger to fly the camera. |"]]