loadStyle

fun StyleController.loadStyle(style: StyleDescriptor, onSuccess: () -> Unit, onFailure: (LoadingStyleFailure) -> Unit): Cancellable

Loads and sets new map style. Calls onSuccess in case of success or onFailure in case of failure.

Allows settings style with more kotlin friendly callback

map.loadStyle(style, onSuccess = { /*doStuff*/}, onFailure = { /*doStuff*/})

instead of

map.loadStyle(style, object : StyleChangedCallback {
override fun onSuccess() {
/*doStuff*/
}
override fun onError(error: LoadingStyleException) {
/*doStuff*/
}
})

Important: This is a Public Preview API. It may be changed or removed at any time.

Return

Cancellable which can be used to cancel the operation.

Parameters

style

StyleDescriptor for the style.

onSuccess

Function called after a successful style change.

onFailure

Function called when a failure occurs.