# Pin

    @MainActor
    @preconcurrency
    struct Pin

    extension Pin : Sendable, SendableMetatype, View

A SwiftUI view that renders a map pin.

The appearance of the pin, including its background color, border color, scale, and glyph, can be
customized using a `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Pin/Configuration.html` object.

`Pin` is used internally by `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Marker3D.html`s with the `.pin` style, and as a SwiftUI view with the
`https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Marker.html` type.

Examples customizing a `Pin` for `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Marker.html`:

    Marker(position: .init(latitude: 0, longitude: 0)) {
        Pin(configuration: .init(backgroundColor: .blue, borderColor: .black))
    }
    Marker(position: .init(latitude: 0, longitude: 0)) {
        Pin(configuration: .red)
    }

- `


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


  ` 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

- `


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


  ` A configuration that defines the visual properties of a Pin.
  This type can be used with the `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Marker.html` or `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Marker3D.html` types to customize the appearance of a
  pin-style marker.

  Example usage:

      // Create a pin with a red background, black border, and default inner circle glyph.
      let redPin = Pin.Configuration(backgroundColor: .red, borderColor: .black)

      // Create a pin with a green background and a custom image glyph.
      let glyphPin = Pin.Configuration(backgroundColor: .green) {
          Image(systemName: "leaf.fill")
              .resizable()
              .scaledToFit()
              .padding(2)
              .foregroundStyle(.white)
      }

      // Use with Marker3D style:
      Marker3D(position: .init(latitude: 0, longitude: 0), style: .pin(redPin))
      Marker3D(position: .init(latitude: 0, longitude: 0), style: .pin(glyphPin))
      Marker3D(position: .init(latitude: 0, longitude: 0), style: .pin(.red))

      // Use with Marker style:
      Marker(position: .init(latitude: 0, longitude: 0)) {
          Pin(configuration: redPin)
      }
      Marker(position: .init(latitude: 0, longitude: 0)) {
          Pin(configuration: glyphPin)
      }
      Marker(position: .init(latitude: 0, longitude: 0)) {
          Pin(configuration: .red)
      }

  #### Declaration

  Swift

      struct Configuration

- `


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


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

- `


  ### [init(configuration:)](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Pin#/s:12GoogleMaps3D3PinV13configurationA2C13ConfigurationV_tcfc)


  ` Creates a map pin view with a pin configuration.

  This type can be used to provide a custom pin view for `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Marker.html`.

  #### Declaration

  Swift

      @MainActor
      @preconcurrency
      init(configuration: Pin.https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Pin/Configuration.html = .init())

  #### Parameters

  |---|---|
  | ` configuration ` | The pin configuration to use for the view. Defaults to the default `https://developers.google.com/maps/documentation/maps-3d/ios-sdk/reference/Structs/Pin/Configuration.html`. |