Sorry, you need to enable JavaScript to visit this website.

Map Kotlin Extensions

Map Kotlin Extensions

Additional classes that make development with Kotlin more pleasant and idiomatic.
This module does not add any new features to the existing TomtomMap API.

To use this library, add the following dependency to the build.gradle file:

api("com.tomtom.online:sdk-maps-ktx-extensions:2.+")

To apply an operation on the TomtomMap:

inline fun MapFragment.applyOnTomtomMap(noinline block: TomtomMap.() -> Unit) {
    getAsyncMap(block)
}

To take advantage of coroutines:

suspend inline fun MapFragment.getTomtomMap(): TomtomMap = suspendCoroutine { cont ->
    val callback = OnMapReadyCallback { tomtomMap -> cont.resume(tomtomMap) }
    getAsyncMap(callback)
}