RxSwift is a library for reactive programming in Swift that allows asynchronous data streams to be represented as Observables. It provides components like Observables, Observers, and Schedulers that allow asynchronous and event-based programs to be written in a functional, non-blocking manner. RxSwift uses operators to filter, transform, and combine Observable data streams and includes extensions for UI bindings and almost any other type of object.
Almost one year back I made my first app using reactive programming library RxSwift.
It's always hard to start and especially about this kind of topic.
Batman - superhero.
Some of you might think what is reactive and why is it needed. I hope after this presentation some of you would start thinking that it can be useful in your everyday tasks.
Imperative programming is a programming paradigm that uses statements to change the program’s state.
Much like you would use imperative language while playing with your dog — “Fetch! Lay down! Play dead!” — you use imperative code to tell the app exactly when and how to do things.
Saved state:
State in variables
Side effects:
Changing the value of a variable;
Writing some data to disk
Enabling or disabling a button in the User Interface
Hard to achieve all these things if the app is asynchronous.
ReactiveX is a library for composing asynchronous and event-based programs by using observable sequences.
Observable: Observable are nothing but the data streams.Observers: Observers consumes the data stream emitted by the observable.Schedulers: Remember that Rx is for asynchronous programming and we need a thread management.
ReactiveX provides a collection of operators with which you can filter, select, transform, combine, and compose Observables. This allows for efficient execution and composition.
For example, imagine your Twitter feed would be a data stream in the same fashion that click events are. You can listen to that stream and react accordingly.
Data streams consists of:
Next
Completed
Error
Observers can:
filter
Transforming
Combining
Operators can be chained together
Buffer by time component, for instance search
RxCocoa is companion library for dealing with UI.
Text labels
Text fields
Table views, collection views
More sophisticated like navigation
Community created extensions
databases like Realm
Firebase
Can create your own
Many times during this year I was in both states. But I think it's fine and need to keep learning.