ViewAnnotation
@_documentation(visibility: public)
@_spi(Experimental)
public struct ViewAnnotation : MapContent
Displays view annotation.
Create a view annotation to display SwiftUI view in Map content.
Map {
ViewAnnotation(CLLocationCoordinate2D(...)) {
Text("🚀")
.background(Circle().fill(.red))
}
}
-
Creates a view annotation.
Declaration
Swift
@available(iOS 13.0, *) @_documentation(visibility: public) public init<Content: View>( _ coordinate: CLLocationCoordinate2D, allowOverlap: Bool = false, anchor: ViewAnnotationAnchor = .center, offsetX: CGFloat? = nil, offsetY: CGFloat? = nil, @ViewBuilder content: @escaping () -> Content )Parameters
coordinateCoordinate the view annotation is bound to.
allowOverlapIf true, the annotation will be visible even if it collides with other annotations. Defaults to false.
anchorSpecifies where the annotation will be located relatively to the given coordinate.
offsetXAdditional X offset, positive values move annotation to right.
offsetYAdditional Y offset, positive values move annotation to top.
ViewAnnotation Structure Reference