MicroUtils/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt

11 lines
286 B
Kotlin
Raw Normal View History

2020-11-10 11:09:14 +00:00
package dev.inmo.micro_utils.coroutines
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
suspend inline fun <T> doInUI(noinline block: suspend CoroutineScope.() -> T) = withContext(
Dispatchers.Main,
block
)