July 2018
Intermediate to advanced
266 pages
7h 11m
English
When dealing with data sources, it's common to retrieve and display information on demand. In a news reader, for example, you may want to fetch only some articles when the user first opens the app, and fetch more as the user scrolls down. And depending on the source of the information, this data can potentially be infinite.
In this chapter, we will talk about different ways to implement data sources as suspending functions and as async functions by leveraging Kotlin's concurrency primitives. We will start by doing sample implementations using the Fibonacci sequence both as an iterator and as a sequence, and then we will add suspending data retrieval to our RSS reader.
Some of the topics covered in this ...
Read now
Unlock full access