Reactive Cocoa && MVVM

  • View
    73

  • Download
    4

  • Category

    Mobile

Preview:

Citation preview

Quiz 1

Quiz 2

What is the homework?

Homework

ReactiveCocoa && MVVMHai Feng Kao

MVC (Model View Controller)

ModelView Controller

Input

Update

Update

Notify

禪師 -鈴木俊隆

MVC (Model View Controller)

Model

View ControllerInput

Update

Notify Update

View Selection

MVC (Model View Controller)

• Pros : • Independent module• Reusable model

• Cons:• too may files• hard to write unit test• controller need to access view&model

MVVM(Model View ViewModel)

ModelView ViewModel

Input Update

MVVM(Model View ViewModel)

• Pros:• ViewModel can be unit tested

• ViewModel has no access to view• Model has no access to ViewModel

• View is simple• UI logic moved to ViewModel

• Cons:• hard to debug• performance hit!!!

MVVM(Model View ViewModel)

ModelView ViewController ViewModelReactiveCocoa

Demo

• Do it

Next Class

Q&A

Thank you