observe

Calls onChange with every ConnectivityMonitor.isConnected value on the main thread (or Dispatchers.Default where no main dispatcher exists). For Swift and for code without coroutines.

Return

a handle; close() it to stop observing.