GoogleMaps3D Framework Reference

Marker3D

  @MainActor 
 @preconcurrency 
 struct 
 Marker3D 
 
  extension 
 Marker3D 
 : 
 MapContent 
 , 
  MapContentAnchorable 
 
 , 
  MapContentTappable 
 
 , 
 Sendable 
 , 
 SendableMetatype 
 , 
 View 
 

A 3D marker that can be placed on a map.

  Map 
 ( 
 mode 
 : 
 . 
 hybrid 
 ) 
 { 
 Marker3D 
 ( 
 position 
 : 
 . 
 init 
 ( 
 latitude 
 : 
 37.7749 
 , 
 longitude 
 : 
 - 
 122.4194 
 , 
 altitude 
 : 
 0 
 )) 
 } 
 
  • 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 
     
    
  • Defines the visual style and content of a Marker3D .

    Declaration

    Swift

      struct 
     Style 
     
    
  • Specifies how altitude in the position is interpreted.

    Default value: clampToGround

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     altitudeMode 
     : 
      AltitudeMode 
     
     
    
  • 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 
     } 
     
    
  • Specifies how a Marker3D should behave when it collides with another Marker3D or with the default map labels.

    Default value: required

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     collisionBehavior 
     : 
      CollisionBehavior 
     
     
    
  • Specifies whether this Marker3D should be drawn or not when it’s occluded. The Marker3D can be occluded by map geometry (e.g. buildings).

    Default value: false

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     drawsWhenOccluded 
     : 
     Bool 
     
    
  • Specifies whether to connect the Marker3D to the ground. To extrude a Marker3D, the altitudeMode must be either relativeToGround , relativeToMesh or absolute .

    Default value: false

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     extruded 
     : 
     Bool 
     
    
  • Creates a new Marker3D.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     init 
     ( 
     position 
     : 
      LatLngAltitude 
     
     , 
     altitudeMode 
     : 
      AltitudeMode 
     
     = 
     . 
     clampToGround 
     , 
     collisionBehavior 
     : 
      CollisionBehavior 
     
     = 
     . 
     required 
     , 
     extruded 
     : 
     Bool 
     = 
     false 
     , 
     drawsWhenOccluded 
     : 
     Bool 
     = 
     false 
     , 
     sizePreserved 
     : 
     Bool 
     = 
     false 
     , 
     zIndex 
     : 
     Int32 
     = 
     0 
     , 
     label 
     : 
     String 
     = 
     "" 
     , 
     style 
     : 
     Marker3D 
     . 
      Style 
     
     = 
     . 
     default 
     ) 
     
    

    Parameters

    position

    The position of the Marker3D.

    altitudeMode

    Specifies how altitude in the position is interpreted. Default value: clampToGround

    collisionBehavior

    Specifies how a Marker3D should behave when it collides with another Marker3D or with the default map labels. Default value: required

    extruded

    Specifies whether to connect the Marker3D to the ground. To extrude a Marker3D, the altitudeMode must be either relativeToGround , relativeToMesh or absolute . Default value: false

    drawsWhenOccluded

    Specifies whether this Marker3D should be drawn or not when it’s occluded. The Marker3D can be occluded by map geometry (e.g. buildings). Default value: false

    sizePreserved

    Specifies whether this Marker3D should preserve its size or not regardless of distance from camera. By default the Marker3D is scaled based on distance from camera/tilt. Default value: false

    zIndex

    The zIndex compared to other 3D Marker3Ds. By default, Marker3Ds are displayed according to their vertical position on screen, with lower Marker3Ds appearing in front of Marker3D farther up the screen. Note that zIndex is also used to help determine relative priority between CollisionBehavior.optionalAndHidesLowerPriority 3D Marker3Ds. A higher zIndex value indicates higher priority. Default value: 0`

    label

    Text to be displayed by this Marker3D. Defaults to empty string.

    style

    The style of the Marker3D.

  • Text to be displayed by this Marker3D.

    Defaults to empty string.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     label 
     : 
     String 
     
    
  • Sets the position.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     position 
     : 
      LatLngAltitude 
     
     
    
  • Specifies whether this Marker3D should preserve its size or not regardless of distance from camera. By default the Marker3D is scaled based on distance from camera/tilt.

    Default value: false

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     sizePreserved 
     : 
     Bool 
     
    
  • The zIndex compared to other 3D Marker3Ds. By default, Marker3Ds are displayed according to their vertical position on screen, with lower Marker3D s appearing in front of Marker3D farther up the screen. Note that zIndex is also used to help determine relative priority between CollisionBehavior.optionalAndHidesLowerPriority 3D Marker3Ds. A higher zIndex value indicates higher priority.

    Default value: 0

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     zIndex 
     : 
     Int32 
     
    
Create a Mobile Website
View Site in Mobile | Classic
Share by: