Skip to content

Marker Icons

Marker icons conform to MarkerIconProtocol.

Use marker icons to control the visual representation of Marker and MarkerState. The icon object is stored on the marker state and synchronized to the native provider marker.

DefaultMarkerIcon draws the SDK’s default pin. It is the easiest way to get consistent marker visuals across providers.

let icon = DefaultMarkerIcon(
fillColor: .red,
strokeColor: .white,
label: "A"
)
Marker(
position: GeoPoint(latitude: 35.6812, longitude: 139.7671),
icon: icon
)

Available initializer parameters include fillColor, strokeColor, strokeWidth, scale, label, labelTextColor, labelTextSize, labelTypeFace, labelStrokeColor, infoAnchor, iconSize, and debug.

Use label for short text such as a one-letter category, sequence number, or compact abbreviation.

ImageIcon uses a UIImage directly. Use it when your app already has an image asset for the marker.

let icon = ImageIcon(
image: UIImage(named: "custom-marker")!,
iconSize: 48,
anchor: CGPoint(x: 0.5, y: 1.0)
)

ImageDefaultIcon clips an image into the default pin shape.

let icon = ImageDefaultIcon(
backgroundImage: UIImage(named: "avatar")!,
strokeColor: .white,
label: "1"
)

BitmapIcon wraps a rendered UIImage. Use it when you render a SwiftUI view or other custom drawing into an image before passing it to the marker system.

let icon = BitmapIcon(
bitmap: image,
anchor: CGPoint(x: 0.5, y: 1.0),
scale: 1.0
)
  • Use DefaultMarkerIcon for simple pins, color coding, and short labels.
  • Use ImageIcon when you want the marker to be exactly the image you provide.
  • Use ImageDefaultIcon when you want image content inside the default pin shape.
  • Use BitmapIcon when the image is generated at runtime.