MTTextPopup

public class MTTextPopup : MTAnnotation, MTMapViewContent, @unchecked Sendable

Basic text popup.

Can be attached to MTMarker or standalone.

  • Unique id of the popup.

    Declaration

    Swift

    public private(set) var identifier: String { get }
  • Position of the popup on the map.

    Declaration

    Swift

    public private(set) var coordinates: CLLocationCoordinate2D { get }
  • Text content of the popup.

    Declaration

    Swift

    public private(set) var text: String { get }
  • The pixel distance from the popup’s coordinates.

    Declaration

    Swift

    public private(set) var offset: Double? { get }
  • Initializes the popup with the specified position and text.

    Declaration

    Swift

    public init(
        coordinates: CLLocationCoordinate2D,
        text: String,
        offset: Double = 0.0
    )

    Parameters

    coordinates

    Position of the popup.

    text

    Text content of the popup.

  • Sets coordinates for the popup.

    Declaration

    Swift

    @available(iOS, deprecated: 16.0, message: "Prefer the async version for modern concurrency handling")
    @MainActor
    public func setCoordinates(
        _ coordinates: CLLocationCoordinate2D,
        in mapView: MTMapView,
        completionHandler: ((Result<Void, MTError>) -> Void)? = nil
    )

    Parameters

    coordinates

    Position of the popup

    mapView

    Map view to apply to.

    completionHandler

    A handler block to execute when function finishes.

  • setCoordinates(_:in:) Asynchronous

    Sets coordinates for the popup.

    Declaration

    Swift

    @MainActor
    public func setCoordinates(_ coordinates: CLLocationCoordinate2D, in mapView: MTMapView) async

    Parameters

    coordinates

    Position of the popup.

    mapView

    Map view to apply to.

  • Adds popup to map DSL style.

    Prefer addTextPopup(_:) instead.

    Declaration

    Swift

    public func addToMap(_ mapView: MTMapView)