# Polygon

    @MainActor
    @preconcurrency
    struct Polygon

    extension Polygon : MapContent, https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Protocols.html#/s:12GoogleMaps3D18MapContentTappableP, 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),
        ]
      )
    }

- `


  ### [Body](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV4Bodya)


  ` 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

- `


  ### [StyleOptions](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon/StyleOptions.html)


  `

  #### Declaration

  Swift

      struct StyleOptions

      extension https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon.html.StyleOptions : Equatable, Hashable

- `


  ### [altitudeMode](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV12altitudeModeAA08AltitudeE0Ovp)


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

  #### Declaration

  Swift

      @MainActor
      @preconcurrency
      let altitudeMode: https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Enums/AltitudeMode.html

- `


  ### [body](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV4bodyQrvp)


  ` 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 }

- `


  ### [geometry](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV8geometryAA0C8GeometryVvp)


  ` Represents the polygon's shape.

  #### Declaration

  Swift

      @MainActor
      @preconcurrency
      let geometry: https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/PolygonGeometry.html

- `


  ### [init(geometry:altitudeMode:zIndex:)](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV8geometry12altitudeMode6zIndexAcA0C8GeometryV_AA08AltitudeF0Os5Int32Vtcfc)


  ` Initializes a polygon with a polygon geometry.

  #### Declaration

  Swift

      @MainActor
      @preconcurrency
      init(geometry: https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/PolygonGeometry.html, altitudeMode: https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Enums/AltitudeMode.html = .clampToGround, zIndex: Int32 = 0)

  #### Parameters

  |---|---|
  | ` geometry ` | The `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/PolygonGeometry.html` 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. |

- `


  ### [init(path:innerPaths:altitudeMode:zIndex:)](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV4path10innerPaths12altitudeMode6zIndexACSayAA14LatLngAltitudeVG_SayAJGAA0lH0Os5Int32Vtcfc)


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

  #### Declaration

  Swift

      @MainActor
      @preconcurrency
      init(path: [https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/LatLngAltitude.html], innerPaths: [[https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/LatLngAltitude.html]] = [], altitudeMode: https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Enums/AltitudeMode.html = .clampToGround, zIndex: Int32 = 0)

  #### Parameters

  |---|---|
  | ` path ` | The array of `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/LatLngAltitude.html` defining the outer boundary of the polygon. |
  | ` innerPaths ` | An array of arrays of `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/LatLngAltitude.html`, 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. |

- `


  ### [style(_:)](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV5styleyA2C12StyleOptionsVF)


  `

  #### Declaration

  Swift

      @MainActor
      @preconcurrency
      func style(_ style: Polygon.https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon/StyleOptions.html) -> Polygon

- `


  ### [styleOptions](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV12styleOptionsAC05StyleE0Vvp)


  ` Style options of the polygon.

  #### Declaration

  Swift

      @MainActor
      @preconcurrency
      var styleOptions: Polygon.https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon/StyleOptions.html

- `


  ### [zIndex](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Polygon#/s:12GoogleMaps3D7PolygonV6zIndexs5Int32Vvp)


  ` The draw order compared to other polys.
  Default value: 0.

  #### Declaration

  Swift

      @MainActor
      @preconcurrency
      let zIndex: Int32