# Location

### Fetch Last Known Location

To fetch a user's last known location, the following API can be used.

### Concrete example

{% tabs %}
{% tab title="Swift" %}

```swift
let service = LocationService()
service.fetchLastKnownLocation(then: { result in
    guard !result.value.isEmpty else {
        // error
        return
    }
    completionHandler(.success(result.value))
})
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val service = LocationService()
service.fetchLastKnownLocation() { result: Result<Content?>? ->
    if (result?.value == null || result.throwable != null) {
        // failure
    } else {
        // Success
        val content = result.value
    }
})
```

{% endtab %}
{% endtabs %}
