# TripLocations

Provides an API for receiving locations during trips.

## TripLocations API

### `startReceivingUpdates(with:_:)`

Starts delivering periodic location updates during the trip. To stop the updates, call [stopReceivingUpdates()](#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.

```swift
func startReceivingUpdates(
        with interval: TimeInterval,
        _ locationHandler: @escaping (TripLocation) -> Void
) -> TripLocationsStartReceivingResult
```

<table><thead><tr><th width="194.53814697265625">Parameter</th><th></th></tr></thead><tbody><tr><td>interval</td><td>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.</td></tr><tr><td>locationHandler</td><td>A closure invoked on the main thread with the latest <a href="triplocation">TripLocation</a> when available.</td></tr></tbody></table>

### `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:\_:)](#startreceivingupdates-with).

```swift
func startReceivingUpdates(
        with interval: TimeInterval,
        _ locationHandler: @escaping (TripLocation) -> Void
) -> TripLocationsStartReceivingResult
```
