GoogleMaps3D Framework Reference

Polygon

  @MainActor 
 @preconcurrency 
 struct 
 Polygon 
 
  extension 
 Polygon 
 : 
 MapContent 
 , 
  MapContentTappable 
 
 , 
 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 
 ), 
 ] 
 ) 
 } 
 
  • 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 
     
    
  • Declaration

    Swift

      struct 
     StyleOptions 
     
    
      extension 
      Polygon 
     
     . 
     StyleOptions 
     : 
     Equatable 
     , 
     Hashable 
     
    
  • Specifies how altitudes in the path are interpreted. Default value: clampToGround.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     let 
     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 
     } 
     
    
  • Represents the polygon’s shape.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     let 
     geometry 
     : 
      PolygonGeometry 
     
     
    
  • Initializes a polygon with a polygon geometry.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     init 
     ( 
     geometry 
     : 
      PolygonGeometry 
     
     , 
     altitudeMode 
     : 
      AltitudeMode 
     
     = 
     . 
     clampToGround 
     , 
     zIndex 
     : 
     Int32 
     = 
     0 
     ) 
     
    

    Parameters

    geometry

    The PolygonGeometry that defines the polygon’s shape.

    altitudeMode

    Specifies how altitudes in the path are interpreted. Default value: .clampToGround.

    zIndex

    The draw order compared to other polygons. Default value: 0.

  • Initializes a polygon with a path and optional inner paths.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     init 
     ( 
     path 
     : 
     [ 
      LatLngAltitude 
     
     ], 
     innerPaths 
     : 
     [[ 
      LatLngAltitude 
     
     ]] 
     = 
     [], 
     altitudeMode 
     : 
      AltitudeMode 
     
     = 
     . 
     clampToGround 
     , 
     zIndex 
     : 
     Int32 
     = 
     0 
     ) 
     
    

    Parameters

    path

    The array of LatLngAltitude defining the outer boundary of the polygon.

    innerPaths

    An array of arrays of LatLngAltitude , each defining an inner boundary (hole) within the polygon. Defaults to an empty array.

    altitudeMode

    Specifies how altitudes in the path are interpreted. Default value: .clampToGround.

    zIndex

    The draw order compared to other polygons. Default value: 0.

  • Declaration

    Swift

      @MainActor 
     @preconcurrency 
     func 
     style 
     ( 
     _ 
     style 
     : 
     Polygon 
     . 
      StyleOptions 
     
     ) 
     -> 
     Polygon 
     
    
  • Style options of the polygon.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     var 
     styleOptions 
     : 
     Polygon 
     . 
      StyleOptions 
     
     
    
  • The draw order compared to other polys. Default value: 0.

    Declaration

    Swift

      @MainActor 
     @preconcurrency 
     let 
     zIndex 
     : 
     Int32 
     
    
Design a Mobile Site
View Site in Mobile | Classic
Share by: