July 2018
Intermediate to advanced
266 pages
7h 11m
English
To make the implementation more interesting, let's make it so that the UI can listen to increments in the counter – and update the label – by subscribing to a channel. First, let's add a channel property to ResultsCounter:
object ResultsCounter { private val context = newSingleThreadContext("counter") private var counter = 0 private val notifications = Channel<Int>(Channel.CONFLATED) ...}
Read now
Unlock full access