Beginning RxKotlin | Ray Wenderlich

In this course, you will be introduced to reactive programming in Kotlin and Android with RxKotlin. You'll learn about observables, subscribing, and more, and how to use RxKotlin in your Android app projects.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/7419-beginning-rxkotlin

I was wondering if I understood this correctly…

For a the code where we bring in the file of ANewHope.txt we do:
fun loadText(filename: String): Single{
return Single.create create@{ emitter →
…
}
this creates a single observerable for the file. the emitter traverses through this SINGLE file.

@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi Jose! Thanks for the question.

Inside the loadText() method, we use the Kotlin extension function file.readText(UTF_8) to read the contents of the file. If the file is successfully read, the Single observable emits just one string, which is the contents of the entire file. If the file is not read, the Single emits an error event.