TripLocations
Provides an API for receiving locations during trips.
TripLocations API
startReceivingUpdates(with:_:)
startReceivingUpdates(with:_:)Starts delivering periodic location updates during the trip. To stop the updates, call stopReceivingUpdates().
If this method returns TripLocationsStartReceivingResult.success, the provided handler becomes the active handler. A previously registered handler will no longer receive trip location updates.
If this method returns any value other than TripLocationsStartReceivingResult.success, no changes will be made to the previously registered handler. It remains active and continues receiving location updates.
func startReceivingUpdates(
with interval: TimeInterval,
_ locationHandler: @escaping (TripLocation) -> Void
) -> TripLocationsStartReceivingResultinterval
The desired time interval, in seconds, between successive location updates. Must be at least 1 second. The actual delivery cadence may vary depending on system conditions.
locationHandler
A closure invoked on the main thread with the latest TripLocation when available.
stopReceivingUpdates()
stopReceivingUpdates()Stops delivering trip location updates.
Call this method to stop delivery of location updates to the handler that you previously supplied to startReceivingUpdates(with:_:).
func startReceivingUpdates(
with interval: TimeInterval,
_ locationHandler: @escaping (TripLocation) -> Void
) -> TripLocationsStartReceivingResultLast updated