iOS quickstart (Swift)

Requires iOS 15 or macOS 12, Xcode 16 or later.

Get a key

In Atlas Studio, create an app key with your app's bundle ID and these features: Routes (core_routing), Navigation (navigation) and Maps (map_tiles). The secret is shown once: keep it out of source control (a build setting or an .xcconfig you don't commit). Studio's code sample needs only the key: the configuration defaults to the Atlas service and map viewer (below). A call for a feature the key doesn't have fails with capability_required, naming the feature to turn on.

1. Add the package

Unzip the release archive (MeridianAtlas-0.1.0-rc.6.zip). In Xcode: File > Add Package Dependencies… > Add Local…, choose the MeridianAtlas folder, then import MeridianAtlas.

Configure the key

Make one AtlasConfiguration and give it to every client, the navigation session and the map:

Swift
let atlas = try AtlasConfiguration(apiKey: apiKey)
let routes = AtlasRoutes(configuration: atlas)
let navigation = AtlasNavigation(configuration: atlas, onUpdate: { update in /* below */ })  // reroutes and registers its legs itself
let map = try AtlasMapView(configuration: atlas)                                             // the viewer gets the key
// AtlasMultiStop, AtlasRouteMatrix, AtlasPlaces, AtlasTraffic, AtlasNavigationLegs and AtlasRoads too

The configuration defaults to the Atlas service at https://api.meridianatlas.dev and the map viewer at https://maps.meridianatlas.dev/v1, so this needs only your key. That domain isn't live yet: until it is, beta partners pass the two addresses Meridian gave them:

Swift
let atlas = try AtlasConfiguration(apiKey: apiKey, baseURL: URL(string: "https://your-atlas-host")!,
                                   viewerURL: URL(string: "https://your-atlas-viewer")!)

(AtlasConfiguration.defaultBaseURL and defaultViewerURL name the defaults.) baseURL and viewerURL must use HTTPS; plain HTTP works only in a debug build, to this device (localhost, 127.0.0.1) or 10.0.2.2. timeout (seconds, default 30) applies to each request. Every request names your app by its bundle ID (Atlas-App), so an app key made in Atlas Studio for that bundle ID works; an app key used from an app it doesn't list fails with app_not_allowed. Pass appIdentity: nil to send none (server keys don't need it). The older initialisers, AtlasRoutes(baseURL:apiKey:) and the rest, still work and also send the bundle ID, but every sample below takes the configuration.

App setup

Your app owns location. In its Info.plist:

  • NSLocationWhenInUseUsageDescription: why the app needs location, for example "Your position is used to guide you along the route."
  • To keep guiding with the screen locked or another app in front: the location entry in UIBackgroundModes (Signing & Capabilities > Background Modes > Location updates), and NSLocationAlwaysAndWhenInUseUsageDescription if you will also ask for Always.

Set up the location manager for driving, and ask before starting it:

Swift
let manager = CLLocationManager()
manager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
manager.activityType = .automotiveNavigation
manager.pausesLocationUpdatesAutomatically = false   // else iOS pauses fixes in a long queue
manager.allowsBackgroundLocationUpdates = true       // only with the location background mode: it traps without it
manager.showsBackgroundLocationIndicator = true
manager.requestWhenInUseAuthorization()
manager.startUpdatingLocation()                      // once authorised, when navigation begins

Before guidance begins, AtlasError.location(manager) says whether the user has allowed location: location_permission_required (not asked yet, or refused) or location_accuracy_reduced (Precise Location off, kilometres out), each with a message saying what to ask for, or nil when guidance can begin.

The package's privacy manifest (PrivacyInfo.xcprivacy) declares precise location, used for the app's functionality, not linked to the user and not used for tracking (reroutes send the car's position to the Atlas service). The package uses none of the APIs Apple asks a reason for. Xcode adds the manifest to your app's privacy report.

2. Getting a route

Swift
let routes = AtlasRoutes(configuration: atlas)   // atlas: from "Configure the key"
let route = try await routes.route(from: [-2.2511, 53.4747], to: [-2.246, 53.4837])
// route.guidance: the steps to show and speak; route.plan: what navigation.begin() takes
// route.speedSections: the speed limits along it

Pass departureTime: (a Date) to plan a later journey, trafficAware: true to allow for traffic, and approach: .curb to arrive with the destination on the driver's side of the road (the left in the UK). The route's plan keeps these (route.plan.options), so its reroutes are asked for the same way. Each step's laneGuidance has the lanes (left to right), which to be in (recommendedLaneIndexes, preferredLaneIndex) and where the advice comes from (source: .mapped, .inferred or .none); signpost has what the sign says. Redirects are refused, so the key never follows one. A failure is an AtlasError (see Errors); route_unresolved means there is no route between those points.

3. Route guidance

Swift
let navigation = AtlasNavigation(configuration: atlas, onUpdate: { update in
    for effect in update.effects where effect.type == "route_replaced" {
        // The session rerouted: show the new route, and guide by its steps from now on.
        if let route = effect.route { map.show(route) }
    }
})
let state = try navigation.begin(route.plan)   // the AtlasRoute from routes.route(from:to:)

Feed it every Core Location fix and a timer tick (about once a second, so GPS loss is noticed):

Swift
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    locations.forEach { navigation.ingest($0) }
}
let ticker = Timer(timeInterval: 1, repeats: true) { _ in navigation.tick() }
RunLoop.main.add(ticker, forMode: .common)  // .common: it keeps ticking while the user scrolls

update.snapshot has phase (on_route, rerouting, gps_unavailable, …), progressM and remainingM. Show the first guidance step whose atMetres is beyond progressM. Through a tunnel progress is estimated from the last speed and positionEstimated is true: show the position as estimated.

Rerouting

Made with a configuration, the session reroutes by itself. When the car leaves the route, it fetches a new one: from where the car is, facing the way it is going, to the destination (on a multi-stop route, the next stop not yet reached), asked the way the route was (its plan's options: profile, traffic, side of the road, and a departure time moved on by the time guidance has run). Guidance keeps the old route until the new one arrives. Your app only shows the new route: route_replaced carries it as effect.route.

It doesn't reroute a car crawling off the route (a car park, a forecourt, a queue) unless it has turned round. For apps that show what is happening, the updates say:

  • request_reroute: a route is being fetched (phase is rerouting).
  • route_replaced: the new route is in use (effect.route).
  • reroute_failed: the fetch failed (reason is the error's code, or no_answer after 20 seconds). The old route is kept, and the session asks again at retryAtMs: after 3 seconds, then 6, 12 and so on, up to a minute.
  • reroute_cancelled: the car came back to the route (reason is back_on_route), so the fetch was dropped.
  • reroute_deferred: no connection (offline), or waiting before asking again (backoff). Call setConnectivity(false) when the device goes offline, and reroutes wait instead.

Answering reroutes yourself

Pass rerouting: to use your own routing:

Swift
// Your routing, run as automatic rerouting is: one fetch at a time, dropped when no longer needed.
let custom = AtlasNavigation(configuration: atlas, rerouting: .custom { effect in
    try await yourRouter.route(from: effect.origin!, to: effect.destination!, heading: effect.headingDegrees)
})
// Or answer each request_reroute yourself, with completeReroute or failReroute.
let manual = AtlasNavigation(configuration: atlas, rerouting: .manual)

With .manual, and without a configuration (AtlasNavigation(onUpdate:)), answer each request_reroute: completeReroute(requestId:route:) with the new route (routes.reroute(effect) fetches it), or failReroute(requestId:failure:) when the fetch failed. The session keeps the old route and asks again. A request left unanswered for 20 seconds counts as failed.

Turn-by-turn guidance is charged per leg: one leg is guidance to one destination, and the reroutes on the way are included (the key needs the navigation feature). Made with the configuration, the session does this itself:

Swift
let navigation = AtlasNavigation(configuration: atlas, onUpdate: { update in /* as above */ },
                                 onError: { error in log(error) })   // leg_registration_failed: guidance carries on
_ = try navigation.begin(route.plan)                 // registers the leg to the route's end, in the background
_ = try navigation.stop()                            // ends the leg (on arrival it ends itself)
  • begin registers the leg in the background; guidance never waits for it. Beginning again to the same destination (within 50 m) keeps the leg; a new destination ends it and starts another. navigation.legId is the leg, once registered.
  • Each request_reroute effect carries legId, and the session's reroutes send it (so does routes.reroute(effect), if you answer yourself), so a reroute costs nothing more. A leg includes 50 reroutes: after that, or if the service refuses the leg, the session reroutes without it, charged as a route, and onError gets leg_invalid once. A reroute asked for before the leg is registered goes without one, and is charged as a route.
  • A failure that may pass (no connection, a timeout, rate_limit, a 5xx) is tried again after 1, 2, 4, 8 and 16 seconds, with the same Idempotency-Key, so the leg is charged once. If it still can't be registered (or the key is refused: capability, status and the message say why), onError gets an AtlasError with code leg_registration_failed, on the main queue, once. Guidance carries on, and its reroutes are charged as routes.
  • Arrival ends the leg (arrived), and so does stop() (cancelled).

Without a configuration the session contacts no server; do the same by hand:

Swift
let legs = AtlasNavigationLegs(configuration: atlas)
let leg = try await legs.start(destination: route.coordinates.last!)      // when guidance starts
let replacement = try await routes.reroute(effect, legId: leg.legId)      // on request_reroute: included in the leg
_ = try await legs.end(legId: leg.legId, reason: .arrived)                // on arrival (.cancelled when the driver stops)

Pass reroute the original route's options (options: route.plan.options) to keep them. A reroute must keep the leg's destination (within 50 m): a new destination is a new leg, and so is each stop of a multi-stop route (the session does this itself, see Multi-stop routes; by hand, start one with the stop's point on the route when the driver sets off for it). A leg lasts 24 hours. A reroute with a leg that has ended or expired fails with leg_invalid, and one to somewhere else with leg_destination_mismatch: start a new leg. Asking again for the same request_reroute after a timeout or lost connection reuses its Idempotency-Key, so a request that did reach the service counts once.

Showing the map

AtlasMapView (iOS) is the Atlas 3D map, from the Atlas viewer at the configuration's viewerURL. The viewer gets the configuration's key for its scenery, in the page, never in its URL. Show it the route, then give it each snapshot to move the car, estimated progress through a tunnel included:

Swift
let map = try AtlasMapView(configuration: atlas,
                           presentation: try AtlasMapPresentation(style: .standard, navigationUI: true))
map.onError = { code, message in showStatus("Map: \(message)") }
map.onWarning = { code, active, message in mapNotice.isHidden = !active }
view.addSubview(map)
map.show(route)                                      // the AtlasRoute whose plan you began
// and in your AtlasNavigation onUpdate: map.update(update.snapshot)

AtlasMapView(configuration:viewerBaseURL:) loads the viewerBaseURL you pass instead of the configuration's viewerURL. AtlasMapView(viewerBaseURL:) still works and sends no key.

onError says the map couldn't start or has stopped, with a code: viewer_unavailable (the viewer page didn't load: check viewerURL and the connection), scene_unavailable (no scenery came for that place after every try), viewer_error, context_lost (it lost its graphics context and three reloads didn't bring it back), or route_too_large, invalid_route or unsupported_contract (the viewer refused what it was shown). onWarning is a problem the map carries on through (map_detail_unavailable, context_lost, runtime_error, quality_reduced), with active true when it starts and false when it clears. A lost graphics context is recovered by reloading the map, which keeps what it was shown.

Show it the AtlasRoute (or an AtlasMultiStopRoute), not only its plan: the map then gets the route's guidance, so the route line moves into the lane each junction needs, and its speed limits. A plain AtlasRoutePlan still works and shows only the line. navigationUI: true shows the built-in Meridian guidance panels (manoeuvre, lanes, camera alerts, and the speed with the limit, red when over it); it is off by default, for apps that draw their own. Its banner shows the route's own words ("At the traffic lights, turn right onto Ormskirk Road"), the sign at a fork and a roundabout's exit.

The panels also show:

  • Trip progress: the arrival time, time left and distance left. On a multi-stop trip they show the next stop ("Stop 2 of 4") and the destination.
  • Recentre: the driver can pan and pinch the map, and Recentre brings the camera back to the car, at the camera's own distance, tilt and heading.
  • Overview: the whole remaining route (the car, each stop left and the destination), flat and north-up, clear of the panels. Guidance carries on, and Recentre comes back.
  • Mute: the voice's mute button.
  • The arrival card: at each stop it offers Next stop and End; at the destination, End.

Name the places, and pass the driver's choices on:

Swift
map.show(route, destination: AtlasMapPlace(name: "Interact CC Wigan", address: "Wallgate, Wigan WN1 1BA"))
// A multi-stop trip: map.show(trip, stops: ["tesco": AtlasMapPlace(name: "Tesco Pemberton")])
map.voice = voice // the AtlasVoice speaking your announcements: the mute button mutes and unmutes it
map.onArrivalAction = { action in
    if case .end = action { _ = try? navigation.stop() }
}

With map.voice set, the mute button and the voice follow each other: there is nothing more to write, and voice.isMuted = true from your own settings shows on the button. If you speak with something other than AtlasVoice, pass the taps on yourself: map.onVoiceMutedChanged = { muted in myVoice.isMuted = muted }. map.isVoiceMuted is the mute state. Set it to show your app's own setting on the button. map.recentre() and onFollowingChanged do what the button does, for your own controls; map.showOverview(), isOverview and onOverviewChanged do the same for the overview. AtlasMapPresentation(navigationPanels:) turns panels off one by one, for example AtlasNavigationPanels.all.subtracting(.tripProgress). Without .recentre, the map doesn't move under the driver's fingers, and the overview button doesn't show. AtlasMapPresentation(autoRecentreAfter: 10) brings the camera back to the car by itself 10 seconds after the driver last moved the map or opened the overview (2 to 600 seconds; off by default).

Lay the map out edge to edge (in SwiftUI, .ignoresSafeArea()): the panels keep clear of the status bar, the Dynamic Island or notch and the home indicator by themselves, upright and on its side, and their text follows Dynamic Type (up to 1.5 times). If your own views cover part of the map, say how much at each edge, measured from the map's edges, and the panels and the car keep clear of them too: map.setInsets(UIEdgeInsets(top: 0, left: 0, bottom: sheetHeight, right: 0)). Set it again when your views move (on rotation, say).

quality: sets how much the map spends on each frame: .auto (the default) starts from what the device says about itself and steps down a tier when frames stay slow (a quality_reduced warning); .high, .balanced and .low hold one tier. map.quality says which tier the map started at, once it is ready.

After a reroute, call show(_:) with the new route (route_replaced's route): it is swapped in place, without reloading the map. In free drive, show the map at the car's first matched point with show(position:) and give it each free-drive snapshot (map.update(update.snapshot) from AtlasFreeDrive's updates); the car follows the road it is matched to, and the map shows the speed limit there.

Speaking the guidance

Atlas decides what to say and when. Any update can carry an announcement in update.announcements: "In 300 yards, turn left onto Deansgate", then "Turn left now".

  • Where they come from: the route's guidance. route.plan carries it, so a route from AtlasRoutes or AtlasMultiStop is announced. A hand-made AtlasRoutePlan without guidance: is guided in silence.
  • When: warnings come further ahead on faster roads, and close manoeuvres are joined ("…, then turn left"). Nothing is said while phase isn't on_route, and after a reroute (the session's own, or yours) the new route is announced with nothing said twice. Each stop of a multi-stop route gets its own arrival.
  • Road numbers: written the way they are said ("the A five-eighty", "junction 19"), so any speech engine says them the British way.

To have Atlas speak them, use the opt-in AtlasVoice:

Swift
let voice = AtlasVoice()   // the best installed British voice
voice.onWillSpeak = { _ in /* duck your own audio */ }
voice.onDidSpeak = { _, _ in if !voice.isSpeaking { /* restore it */ } }
let navigation = AtlasNavigation(configuration: atlas, onUpdate: { update in
    voice.handle(update)
    // …
})
  • Voices:
    • voice.voices(AtlasVoiceFilter(locale: "en-GB", minimumQuality: "enhanced")) lists the installed voices, best first.
    • Choose one with voice.selectedVoiceId; voice.preview(voiceId:) says a sample.
    • Premium and Enhanced voices are downloaded by the user in Settings › Accessibility › Spoken Content › Voices.
    • requestPersonalVoiceAuthorization() asks to use the user's own Personal Voice.
  • Your audio session stays yours: AtlasVoice never changes it. To speak with the screen locked, set a session that plays in the background (.playback, mode .voicePrompt, option .duckOthers) and add the audio background mode.
  • Rules: a more urgent announcement cuts the current one short, and a less urgent one waits for it. A pause drops whatever was waiting. Also isMuted, stop(), and usesSSML (iOS 16 and later: short pauses, and road letters said as letters).
  • Your own voice: AtlasVoice(output:) takes an AtlasVoiceOutput (speak(text:ssml:completion:), stop()), for example a cloud neural voice. Or skip AtlasVoice and speak each announcement's text (or ssml) yourself.

Testing in the simulator

The app owns location, so the simulator's simulated location reaches ingest like real GPS:

  • A drive: a GPX file in Xcode (Debug > Simulate Location while it runs, or the scheme's Run > Options > Default Location), or from a terminal, xcrun simctl location booted start --speed=12 53.47475,-2.25165 53.47983,-2.24868 53.48345,-2.24626 (along Deansgate, Manchester, at 12 m/s).
  • Allow location first: xcrun simctl privacy booted grant location <your bundle ID>.
  • In tests, feed ingest your own CLLocations and pass now: to make time pass, as the package's own tests do; no simulator needed.

4. Free drive (no destination)

Swift
weak var answering: AtlasFreeDrive?   // weak: the free drive keeps this closure, so a strong capture never lets it go
let freeDrive = AtlasFreeDrive(onUpdate: { update in
    roadLabel.text = update.snapshot.roadName
    limitSign.value = update.snapshot.speedLimit   // AtlasSpeedLimit(value: 30, unit: "mph")
    for effect in update.effects where effect.type == "roads_needed" {
        // Load the roads within effect.radiusM of effect.centre: see "Roads for free drive" in the SDK overview.
        try? answering?.setRoads(centre: effect.centre!, radiusM: effect.radiusM!, roads: nearbyRoads)
    }
})
answering = freeDrive
try freeDrive.begin()
// then freeDrive.ingest(location) for each fix and freeDrive.tick() each second

Loading roads

AtlasRoads answers roads_needed from the Atlas service (the key needs the road_attributes feature; each answer is one unit):

Swift
let roads = AtlasRoads(configuration: atlas)
let nearby = try await roads.nearby(centre: effect.centre!, radiusM: effect.radiusM!)
try freeDrive.setRoads(centre: nearby.centre, radiusM: nearby.radiusM, roads: nearby.roads)

Each AtlasRoad has name, ref (A56), highway, maxspeed ("30 mph"; nil when unknown, never a guess), maxspeedForward / maxspeedBackward and oneway, as OpenStreetMap tags them. radiusM is 50 to 2000 metres.

5. Places

Search as the user types, then fetch the place they pick. Use one sessionToken (16 or more characters) from the first keystroke to the pick. fields says which fields to return; the common ones come back typed, and raw has the rest.

Swift
let places = AtlasPlaces(configuration: atlas)
let suggestions = try await places.autocomplete(["input": typed, "sessionToken": sessionToken]).suggestions
guard let picked = suggestions.first(where: { $0.placeId != nil }) else { return } // a query suggestion has no placeId
let place = try await places.place(picked.placeId!, fields: ["id", "displayName", "formattedAddress", "location"],
                                   sessionToken: sessionToken)
// place.displayName, place.formattedAddress, place.location ([lon, lat]), place.types, place.raw

searchText(["textQuery": …], fields:) and searchNearby return places and nextPageToken; photo(placeId:photoId:) returns the image bytes.

6. Traffic

The delay on a route you already have, and how fast each stretch is moving:

Swift
let traffic = AtlasTraffic(configuration: atlas)
let advisory = try await traffic.routeAdvisory(request) // request.requestId: a new UUID per advisory
// advisory.delaySeconds, advisory.speedReadingIntervals[i].state ("normal", "slow", "traffic_jam", "unknown")

7. Route matrix

Distances and driving times from up to 25 origins to up to 25 destinations:

Swift
let matrix = AtlasRouteMatrix(configuration: atlas)
let result = try await matrix.calculate(AtlasRouteMatrixRequest(requestId: "job-17", origins: drivers, destinations: [job]))
let seconds = result.cell(originId: "van-1", destinationId: "job")?.durationSeconds // nil when no route was found

8. Multi-stop routes

One route through 2 to 64 stops in the order given, with a leg per pair:

Swift
let multiStop = AtlasMultiStop(configuration: atlas)
var run = try await multiStop.route(AtlasMultiStopRequest(requestId: "run-17", stops: stops))
// run.legs[i].distanceMetres, .durationSeconds, .guidance; run.plan drives the whole trip, stop by stop
map.show(run)
_ = try navigation.begin(run.plan)
// On route_replaced the session has rerouted to the next stop (effect.stopId); show the whole trip:
//   if let route = effect.route { run = try run.rerouted(effect, route: route); map.show(run) }
  • Arrivals. At each stop before the last an update carries a stop_arrived effect (its stopId and legIndex) and guidance carries on to the next stop; at the last, arrived (with its stopId). leg_started says the car has left a stop (more than 50 m away, or off the route). The snapshot's legIndex, legCount, nextStopId and legRemainingM say which leg is being driven.
  • Reroutes go to the next stop not yet reached, never back to one reached and never straight to the end; a car that drives past a stop without reaching it is rerouted back to it. The session keeps the rest of the trip after that stop; run.rerouted(_:route:) gives the whole trip, for the map. Answering reroutes yourself, the route to that stop is enough.
  • Billing. The route is n − 1 Routes. With a configuration, guiding it is one Navigation leg per stop: the first at begin, each later one when the car leaves the stop before it, each ended at its stop. A run stopped at a stop is never charged the next leg, and the reroutes are free.

9. CarPlay

AtlasCarPlay shows the map, route choices and guidance on CarPlay, and on the dashboard and instrument cluster. Make one when the app starts, give it the routes you guide along and each AtlasNavigationUpdate, and add the SDK's scene delegates to your scene manifest. CarPlay apps need Apple's CarPlay navigation entitlement; the iOS Simulator's CarPlay window works without it. AtlasRouteSimulator drives the session along the route without moving, for testing and for app review. The setup is in the CarPlay and Android Auto guide (docs/sdk/car-screens.md).

Errors

Every service call throws AtlasError, with the same code on every Atlas SDK:

CodeMeaning
invalid_requestThe request was refused as malformed (also thrown before sending)
missing_api_keyThe configuration's key is empty (thrown before sending)
invalid_api_keyThe key is wrong, revoked or expired: copy it again from Atlas Studio, or make a new one
capability_requiredThe key doesn't have this feature; capability names it (turn it on for the key)
app_not_allowedThe key is limited to other apps: make the client from the configuration (it sends your bundle ID), and list that bundle ID on the key
billing_inactive, usage_policy_required, usage_allowance_exhaustedThe account can't be charged for this call
rate_limitToo many requests; retryAfterSeconds says when to try again
outside_coverageThe origin or destination is outside the area Atlas routes (the UK at launch)
route_unresolvedNo route between those points
leg_invalid, leg_destination_mismatch, leg_not_foundThe navigation leg can't be used (ended, expired, unknown, had its 50 reroutes, or a new destination): start a new one. To AtlasNavigation's onError, once: the session's reroutes go on without the leg, charged as routes
leg_registration_failedTo AtlasNavigation's onError: the session couldn't register its leg; guidance carries on, and its reroutes are charged as routes
wrong_service_addressSomething answered at the service address, but not the Atlas service: check baseURL
request_timeout, network_errorNo answer in time, or no connection (or nothing at the service address)
invalid_responseThe answer couldn't be read (a wrong service address, or a network that needs a sign-in page)
service_errorAnything else; status has the HTTP status

isRetryable says whether trying the same call again later can work (no connection, a timeout, a rate limit, a service error with a status of 500 or more), and retryAfterSeconds when the service said. The message says what to fix and ends with a link to the code's entry in Errors, which has every code. requestId is the service's id for the request, to quote to support.

Swift
do {
    route = try await routes.route(from: origin, to: destination)
} catch let error as AtlasError {
    if error.code == "capability_required" { status = "Turn on \(error.capability ?? "this feature") for this key" }
    else if error.isRetryable { status = "No connection: try again" }  // error.retryAfterSeconds, when the service said
    else { status = error.message }                                    // says what to fix, with a link
}

Each client sends your key as X-Atlas-Key and the SDK version as Atlas-Client: ios/0.1.0-rc.6. Calls that are billed per request send an Idempotency-Key; pass idempotencyKey: (a UUID) to make a retry count once.

Threading

Navigation and free-drive calls are synchronous and the update callbacks run inside them. Use one instance from one queue (the main queue is fine: each fix costs well under a millisecond). A session that reroutes by itself (automatic or custom) answers on the main queue, so use it from the main queue. AtlasMapView can be updated from any queue; it moves the work onto the main thread itself. The service clients are async and can be called from any task. An onUpdate closure that uses its own session (or the object that owns it) captures it weakly, as above: the session keeps the closure.

Proposal · draft