Closed OlofT closed 3 years ago
It seems something is blocking the main thread, calling this from Android, into Swift:
print("In main? \(Thread.isMainThread)") //true DispatchQueue.main.async { //never called print("MAIN async") }
I imagine this is due to Android owning the main thread and running its loop there all the time, so the question is perhaps - how to get it to yield for Swift at regular intervals? Or how to make Swift's main process itself on another thread?
The solution is to start the Swift process in another thread:
import kotlin.concurrent.thread ... thread { System.loadLibrary("WeatherCoreBridge") JavaSwift.init() .... }
It seems something is blocking the main thread, calling this from Android, into Swift:
I imagine this is due to Android owning the main thread and running its loop there all the time, so the question is perhaps - how to get it to yield for Swift at regular intervals? Or how to make Swift's main process itself on another thread?