ReactiveCocoa for CincyCocoaDev Meetup
-
Upload
sam-corder -
Category
Software
-
view
104 -
download
3
description
Transcript of ReactiveCocoa for CincyCocoaDev Meetup
![Page 1: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/1.jpg)
REACTIVECOCOAA Dive into Functional Reactive Programming
![Page 3: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/3.jpg)
STATE OF STATE
• KVO
• Callback Blocks
• Delegates
• Target-action mechanisms
• Notifications
![Page 4: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/4.jpg)
CODE
![Page 5: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/5.jpg)
RAC CODE
![Page 6: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/6.jpg)
RAC DEFINED
• RAC Definition
• RAC Birth
• My History
![Page 7: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/7.jpg)
TERMS
• RACStream
• RACSignal
• RACSubscriber
• RACCommand
• RACSequence [Soon to be deprecated]
![Page 8: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/8.jpg)
STREAMS
• Base class for the interesting classes
• Pipes of values retrieved sequentially
• Composed and operated on with operators
![Page 9: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/9.jpg)
SIGNALS• Push driven stream
• Must be subscribed to
• Sends 3 types of events
• Next
• Error
• Complete
![Page 10: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/10.jpg)
TRANSFORMINGOPERATORS
• Mapping - map:
• Filtering - filter:
• Concatenating - concat:
• Flattening - flatten:
• Mapping and Flattening - flattenMap:
![Page 11: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/11.jpg)
COMBINING OPERATORS
• +merge:
• +combineLatest:
• +switchToLatest:
![Page 12: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/12.jpg)
SUBSCRIBER
• subscribeNext:error:completed:
![Page 13: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/13.jpg)
CODE
![Page 14: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/14.jpg)
COMMANDS
• Creates and subscribes to a signal in response to action.
• Can be disabled based on a signal
![Page 15: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/15.jpg)
CODE
![Page 16: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/16.jpg)
MISC GEMS• @weakify/@strongify
• RAC() is a macro that makes the binding look nicer.
• [RACObserve(self, event) subscribeNext:^(Type *vale) {...}];
• [[self rac_signalForSelector:@selector(selector:) fromProtocol:@protocol(SomeDelegate)]
• RACTupleUnpack(Type1 * var1, Type2 * var2…) = args;
![Page 17: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/17.jpg)
MVVMUnder MVVM, the view and view controller become
formally connected; we treat them as one. Views still don’t have references to the model, but neither do controllers. Instead, they reference the view model.
![Page 18: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/18.jpg)
–Lillian Smith
“When you stop learning, stop listening, stop looking and asking questions, always
new questions, then it is time to die.”
![Page 19: ReactiveCocoa for CincyCocoaDev Meetup](https://reader033.fdocuments.us/reader033/viewer/2022060120/5591b3501a28abe11f8b45d2/html5/thumbnails/19.jpg)
RESOURCES• Ray Wenderlich - 2 part tutorial plus YouTube video
• ReactiveCocoa at github.- Read the documentation folder
• Ash Furrow’s blog - teehan+lax
• Ash Furrow’s book - Functional Reactive Programming on iOS (Lean Pub)
• Warning: Some blogs and Stackoverflow posts are based on older versions of RAC. Make sure it refers to 2.x