I'm new to Reactive Programming. I have gone through the documentation of Reactive Cocoa but couldn't realize the differences between RACAble()
, RACObserve()
and RACBind()
.
Please, help ,me in understanding the aspects by some example code snippets.
I think the RACAble()
is replaced with RACObserve()
with some options/arguments. If I am not correct then please correct me in this regard.
Is RACObserve() skip:
similar to RACAble()
?
I think one big source of confusion here is that 3 months ago the ReactiveCocoa
team released v2.0
, which had quite a few breaking changes. This was a great release - and has some amazing features, but it does mean that much of the information you will find on the web is now out-dated.
To your specific points:
RACObserve
is used to create a signal from an object and a keypath, in other words it allows you to take regular properties and 'lift' them into the ReactiveCocoa world. It is a handy replacement for KVO.
RACChannelTo
provides a mechanism for two-way binding. In other words you can keep two properties synchronised. A good example of this is if you want to have a property in your view controller, or some model class, bound to a property on a UIKit control.
Another macro you will probably come across is RAC
, this provides one-way binding. In other words it will set the value of the given property based on the latest value from a signal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With