Reputation: 970
I just started with ReactiveCocoa (and FRP for that matter) and every time I start refactoring my code to be more RAC-based, I ask myself: when should I create a property or a RACSignal?
For example, if I have a ViewModel that does some checking to see if a button can be enabled or not, should I do this:
dynamic var ready: NSNumber //Bool
Or this:
var ready: RACSignal
Upvotes: 1
Views: 488
Reputation: 12421
If you want to start writing more RAC-based code, then I would highly encourage you to use a RACSignal
instead of a value property, for two reasons:
RACSignal
use on view models is arguably more idiomatic (i.e.: a more "RAC" way of doing things).Upvotes: 3
Reputation: 25917
I guess it depends on your use case. If it's a continuous stream of events, it might make sense to use the RACSignal
approach. if it's a one time thing, a Bool
could suit you.
Upvotes: 3