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 } -
The maximum width of the popup in pixels.
Declaration
Swift
public private(set) var maxWidth: Double? { get } -
Boolean value indicating whether the popup uses subpixel positioning.
Declaration
Swift
public private(set) var isSubpixelPositioningEnabled: Bool { get } -
Boolean value indicating whether the popup is tracking the pointer.
Declaration
Swift
public private(set) var isTrackingPointer: Bool { get } -
Boolean value indicating whether the popup is currently open on the map.
Declaration
Swift
public private(set) var isOpen: Bool { get } -
Called when the popup opens on the map.
Declaration
Swift
public var onOpen: (() -> Void)? -
Called when the popup closes from the map.
Declaration
Swift
public var onClose: (() -> Void)? -
Initializes the popup with the specified position and text.
Declaration
Swift
public init( coordinates: CLLocationCoordinate2D, text: String, offset: Double = 0.0, maxWidth: Double? = nil )Parameters
coordinatesPosition of the popup.
textText content of the popup.
-
Sets coordinates for the popup.
Declaration
Parameters
coordinatesPosition of the popup
mapViewMap view to apply to.
completionHandlerA handler block to execute when function finishes.
-
Sets coordinates for the popup.
Declaration
Parameters
coordinatesPosition of the popup.
mapViewMap view to apply to.
completionHandlerA handler block to execute when function finishes.
-
Sets the maximum width of the popup in pixels.
Declaration
Parameters
maxWidthMaximum width in pixels.
mapViewMap view to apply to.
completionHandlerA handler block to execute when function finishes.
-
Sets the pixel offset distance from the popup’s anchor coordinate.
Declaration
Parameters
offsetPixel offset applied on both axes.
mapViewMap view to apply to.
completionHandlerA handler block to execute when function finishes.
-
Enables or disables subpixel positioning for the popup.
Declaration
Parameters
isEnabledBoolean indicating whether subpixel positioning is enabled.
mapViewMap view to apply to.
completionHandlerA handler block to execute when function finishes.
-
Updates the popup text content.
Declaration
Parameters
textText content of the popup.
mapViewMap view to apply to.
completionHandlerA handler block to execute when function finishes.
-
Enables tracking the pointer position for the popup.
Declaration
Parameters
mapViewMap view to apply to.
completionHandlerA handler block to execute when function finishes.
-
Opens the popup on the provided map view.
Declaration
Parameters
mapViewMap view to add the popup to.
completionHandlerA handler block to execute when function finishes.
-
Closes the popup on the provided map view.
Declaration
Parameters
mapViewMap view to remove the popup from.
completionHandlerA handler block to execute when function finishes.
-
Returns current coordinates of the popup.
Declaration
Parameters
mapViewMap view to query.
completionHandlerA handler block to execute when function finishes.
-
Returns a Boolean value indicating whether the popup is currently open.
Declaration
Parameters
mapViewMap view to query.
completionHandlerA handler block to execute when function finishes.
-
setCoordinates(_:Asynchronousin: ) Sets coordinates for the popup.
Declaration
Swift
@MainActor public func setCoordinates(_ coordinates: CLLocationCoordinate2D, in mapView: MTMapView) asyncParameters
coordinatesPosition of the popup.
mapViewMap view to apply to.
-
setLngLat(_:Asynchronousin: ) Sets coordinates for the popup.
Declaration
Swift
@MainActor public func setLngLat(_ coordinates: CLLocationCoordinate2D, in mapView: MTMapView) asyncParameters
mapViewMap view to apply to.
-
setMaxWidth(_:Asynchronousin: ) Sets the maximum width of the popup in pixels.
Declaration
Swift
@MainActor public func setMaxWidth(_ maxWidth: Double, in mapView: MTMapView) asyncParameters
mapViewMap view to apply to.
-
setOffset(_:Asynchronousin: ) Sets the pixel offset distance from the popup’s anchor coordinate.
Declaration
Swift
@MainActor public func setOffset(_ offset: Double, in mapView: MTMapView) asyncParameters
mapViewMap view to apply to.
-
setSubpixelPositioning(_:Asynchronousin: ) Enables or disables subpixel positioning for the popup.
Declaration
Swift
@MainActor public func setSubpixelPositioning(_ isEnabled: Bool, in mapView: MTMapView) asyncParameters
mapViewMap view to apply to.
-
setText(_:Asynchronousin: ) Updates the popup text content.
Declaration
Swift
@MainActor public func setText(_ text: String, in mapView: MTMapView) asyncParameters
mapViewMap view to apply to.
-
trackPointer(in:Asynchronous) Enables tracking the pointer position for the popup.
Declaration
Swift
@MainActor public func trackPointer(in mapView: MTMapView) asyncParameters
mapViewMap view to apply to.
-
open(in:Asynchronous) Opens the popup on the provided map view.
Declaration
Swift
@MainActor public func open(in mapView: MTMapView) asyncParameters
mapViewMap view to add the popup to.
-
close(in:Asynchronous) Closes the popup on the provided map view.
Declaration
Swift
@MainActor public func close(in mapView: MTMapView) asyncParameters
mapViewMap view to remove the popup from.
-
getCoordinates(in:Asynchronous) Returns current coordinates of the popup.
Declaration
Swift
@MainActor public func getCoordinates(in mapView: MTMapView) async -> CLLocationCoordinate2DParameters
mapViewMap view to query.
-
isOpen(in:Asynchronous) Returns a Boolean value indicating whether the popup is currently open.
Declaration
Swift
@MainActor public func isOpen(in mapView: MTMapView) async -> BoolParameters
mapViewMap view to query.
-
Adds popup to map DSL style.
Prefer
addTextPopup(_:)instead.Declaration
Swift
public func addToMap(_ mapView: MTMapView)