Show a map
A map is a MapEngine that holds what the map shows, and a SwiftUI MapView that draws it on iPhone and iPad. Turn on the Elements trait first (install).
The map fetches its style and tiles with your client's key. setTerrain() shows the first terrain of your catalogue.
A later call replaces the itinerary drawn. Cancelling the task withdraws a call still loading.
MapView hands you each tap and each camera at rest:
For what lands under a tap, read the map's events:
A request the map's own loader cannot complete reaches its events. Listen for them and log each:
While a refusal stands, map.state.isAccessRequired is true: show your own notice over the map.
A long press opens a readout of the point: the terrain's altitude, slope and aspect, what is drawn there, and the coordinates. Turn it off with MapView(map, readout: false); the long press still reaches events().
The map shows the Mountaya watermark in the top-left corner of its safe area, unless your organization holds white label. Keep your own views clear of it:
The credit button lists the map's sources, Mountaya first.
Begin an edit, and each tap places the waypoint. A tap near the itinerary's line snaps onto it: