Configuration
struct ConfigurationA configuration that defines the visual properties of a Pin.
This type can be used with the Marker or Marker3D 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(latitude: 0, longitude: 0, style: .pin(redPin))
Marker3D(latitude: 0, longitude: 0, style: .pin(glyphPin))
Marker3D(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
let backgroundColor: Color -
Declaration
Swift
let borderColor: Color -
Creates a new Pin configuration.
Use this configuration to customize the appearance of a Marker3D created with the
.pinstyle.Custom Glyph can be created by passing a custom view
Pin.Configuration { Text("String") .minimumScaleFactor(0.01) } Pin.Configuration { Image(systemName: "plus") .resizable() .scaledToFit() }- backgroundColor: The background
Colorof the pin. - borderColor: The border
Colorof the pin. Defaults to.black. - scale: The scale factor to apply to the pin. Defaults to
1.0. - glyph: A
ViewBuilderclosure providing the Marker3D glyph’s view for a snapshot. The view is constrained to a 15x15 pixel container.
Declaration
Swift
init<GlyphView>(backgroundColor: Color = Color(red: 0.917, green: 0.262, blue: 0.207), borderColor: Color = Color(red: 0.772, green: 0.133, blue: 0.121), scale: Float = 1.0, @ViewBuilder glyph: () -> GlyphView) where GlyphView : ViewParameters
backgroundColorThe background
Colorof the pin.borderColorThe border
Colorof the pin. Defaults to.black.scaleThe scale factor to apply to the pin. Defaults to
1.0.glyphA
ViewBuilderclosure providing the Marker3D glyph’s view for a snapshot. The view is constrained to a 15x15 pixel container. - backgroundColor: The background
-
Creates a new Marker3D configuration.
Use this configuration to customize the appearance of a Marker3D created with the
.pinstyle.Declaration
Swift
init(backgroundColor: Color = Color(red: 0.917, green: 0.262, blue: 0.207), borderColor: Color = Color(red: 0.772, green: 0.133, blue: 0.121), scale: Float = 1.0, innerCircleColor: Color = Color(red: 0.702, green: 0.078, blue: 0.071))Parameters
backgroundColorThe background
Colorof the pin. Defaults to a custom dark red colorborderColorThe border
Colorof the pin. Defaults to a custom red color.scaleThe scale factor to apply to the pin. Defaults to
1.0.innerCircleColorColor of pin’s inner circle. Defaults to a custom dark red color.
-
Google red Marker3D configuration.
Declaration
Swift
static var red: Pin.Configuration { get }Return Value
A
Pin.Configurationinstance configured as a red pin. -
Declaration
Swift
let scale: Float