Reactive Cocoa Operators

29
ReactiveCocoa Operators Hai Feng Kao

Transcript of Reactive Cocoa Operators

ReactiveCocoa OperatorsHai Feng Kao

Quiz 1What does MVVM stand for?

Quiz2What are the advantages of MVVM?

Quiz 3

What is the speaker’s name?

ReactiveCocoa OperatorsHai Feng Kao

Hot n Cold

• Hot Signal• sends values regardless of

whether it has any subscribers

• but only send values after their their subscription time.

• Cold Signal• defers its work and the

sending of any values until it has a subscriber

Cold Signal Example

Hot Signal Example

map

filter

take

skip

skip

• RACObserve sends the current value immediately

distinctUntilChanged

merge

then

RACSubject

combineLatest:reduce:

zip:reduce:

Hot n Cold• Hot Signal

• sends values regardless of whether it has any subscribers

• but only send values after their their subscription time.

• Cold Signal• defers its work and the sending

of any values until it has a subscriber

Cold Signal Example

replay

replayLast

replayLazily

replay (another example)

replayLazily (another example)

same as replay

replayLast (another example)

Next Class

Q&A

Thank you