Practical MVVM Using RxSwift
Mahmoud El-Naggar
Content
● MVVM Architecture
● Reactive Systems
● RxSwift
● RxCocoa
● RxSwift Extensions
● MVVM Architecture
ViewModel ViewControllerModel
View
View
View
Actions
Data
Update
Notify
● MVVM Architecture
1. Model: Contains Data and Notify ViewModel About Any Changes
2. ViewModel: handle actions and send data to ViewController
3. ViewController: Bind data Between ViewModel and View , Also
Handle user actions
● Reactive Systems
https://www.reactivemanifesto.org/
● Reactive Systems
1. Responsive : The application always respond to user actions.
2. Resilient : The application is responsive on state of failure.
3. Elastic/Scalable : Must be responsive when data scale and
increase resources.
4. Message-Driven : Reactive programs depends on Async
messages passing when data changes or event occur to
apply isolation and loose coupling between components.
● Reactive Programming
Observable Pattern :Using to notify a group of listeners about data change.
● RxSwift : Reactive Programming Framework for Swift
Consists of :
● Observables and Subjects :
Observable is a sequence of elements.
Subject is an Observer and also an Observable
Lets Code
● RxSwift :
● Operators
1. Filtering Operators :
2. Transforming Operators
3. Combining Operators
4. Timing Operator
Lets Code
● RxSwift :
● Schedulers : Describes the context where the Observable
will do its work
Lets Code
● RxCocoa
Reactive Framework for UI Components based on
RxSwift that simplify Data Binding between Data and
UI Components
Lets Code
● RxSwift Extensions
1. RxDataSources
2. RxAlamofire
3. RxRealm
4. And more here
Resources And Code
Resources
1. RxSwift: Reactive Programming with Swift
2. http://reactivex.io/
Source Code : https://github.com/mhmoud-
badrit/HappyStore
Thank You :)

Practical MVVM Using RxSwift