> For the complete documentation index, see [llms.txt](https://docs.sentiance.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sentiance.com/important-topics/sdk/api-reference/ios/triplocations.md).

# 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="/pages/HVYrxLkQSVXohuViuwNp">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
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sentiance.com/important-topics/sdk/api-reference/ios/triplocations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
