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
Section titled “DefaultMarkerIcon”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
Section titled “ImageIcon”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
Section titled “ImageDefaultIcon”ImageDefaultIcon clips an image into the default pin shape.
let icon = ImageDefaultIcon( backgroundImage: UIImage(named: "avatar")!, strokeColor: .white, label: "1")BitmapIcon
Section titled “BitmapIcon”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)Choosing an Icon Type
Section titled “Choosing an Icon Type”- Use
DefaultMarkerIconfor simple pins, color coding, and short labels. - Use
ImageIconwhen you want the marker to be exactly the image you provide. - Use
ImageDefaultIconwhen you want image content inside the default pin shape. - Use
BitmapIconwhen the image is generated at runtime.