David Hart
01/20/2021, 1:28 PMThread.currentThread()
from a Kotlin Mobile Multiplatform project to check that I am in the main thread, but it doesn't seem accessible. Are my missing something? Is there another way?Arkadii Ivanov
01/20/2021, 1:29 PMKris Wong
01/20/2021, 2:09 PMThread
is a Java APIedenman
01/20/2021, 7:48 PMexpect fun isMainThread(): Boolean
actual fun isMainThread(): Boolean = Looper.getMainLooper() == Looper.myLooper()
David Hart
01/21/2021, 12:52 PMMichal Klimczak
01/21/2021, 1:57 PMactual
for iOS, it would be something like this
import platform.Foundation.NSThread
actual fun currentThreadName() = "iOS thread ${NSThread.currentThread()} is main: ${NSThread.isMainThread()}"