MTImageSource
public class MTImageSource : MTSource, @unchecked Sendable
An image source.
The url value contains the image location.
The coordinates array contains [longitude, latitude] pairs for the image corners
listed in clockwise order: top left, top right, bottom right, bottom left.
-
Unique id of the source.
Declaration
Swift
public var identifier: String -
URL that points to an image.
Declaration
Swift
public var url: URL? -
Corners of image specified as
CLLocationCoordinate2D. Clockwise order: top-left, top-right, bottom-right, bottom-left.Declaration
Swift
public var coordinates: [CLLocationCoordinate2D] -
Type of the source.
Declaration
Swift
public private(set) var type: MTSourceType { get } -
Initializes the image source with required values.
Declaration
Swift
public init(identifier: String, url: URL, coordinates: [CLLocationCoordinate2D])Parameters
identifierUnique id of the source.
urlURL to the image resource.
coordinatesCorners of image in clockwise order using
CLLocationCoordinate2D.
-
Updates the coordinates of the image source.
Declaration
Parameters
coordinatesNew corners of the image using
CLLocationCoordinate2D.mapViewMTMapView which holds the source.
completionHandlerA handler block to execute when function finishes.
-
Updates the image URL and coordinates simultaneously.
Declaration
Parameters
urlNew image URL.
coordinatesNew corners of the image using
CLLocationCoordinate2D.mapViewMTMapView which holds the source.
completionHandlerA handler block to execute when function finishes.
-
setCoordinates(_:Asynchronousin: ) Updates the coordinates of the image source.
Declaration
Swift
@MainActor public func setCoordinates(_ coordinates: [CLLocationCoordinate2D], in mapView: MTMapView) asyncParameters
coordinatesNew corners of the image using
CLLocationCoordinate2D.mapViewMTMapView which holds the source.
-
updateImage(url:Asynchronouscoordinates: in: ) Updates the image URL and coordinates simultaneously.
Declaration
Swift
@MainActor public func updateImage(url: URL, coordinates: [CLLocationCoordinate2D], in mapView: MTMapView) asyncParameters
urlNew image URL.
coordinatesNew corners of the image using
CLLocationCoordinate2D.mapViewMTMapView which holds the source.
-
Adds source to map DSL style.
Prefer
addSource(_:)on MTMapView instead.Declaration
Swift
public func addToMap(_ mapView: MTMapView)