Contents

init(_:coordinate:anchor:content:)

Creates an annotation that displays a view at a coordinate on the map.

Declaration

@MainActor @preconcurrency init(_ titleResource: LocalizedStringResource, coordinate: CLLocationCoordinate2D, anchor: UnitPoint = .center, @ViewBuilder content: () -> Content) where Label == Text

Parameters

  • titleResource:

    The localized string for the title.

  • coordinate:

    The coordinate to display the annotation at.

  • anchor:

    How to place the content around the provided coordinate.

  • content:

    The view to place on the map.

Discussion

Uses .center for accessoryAnchor. For greater control of selection accessory positioning, please use an initializer with an accessoryAnchor parameter.