Questions tagged [reactive-cocoa]

ReactiveCocoa (RAC) is a Swift framework inspired by Functional Reactive Programming. It provides APIs for composing and transforming streams of values.

ReactiveCocoa (RAC) is a Swift framework inspired by Functional Reactive Programming. It provides APIs for composing and transforming streams of values.

860 questions
0
votes
1 answer

Why doesn't this concat work?

maybe I am misunderstanding concat? why doesn't this code output also "B" I just get an output "A" Shouldn't concat work like this: RACSignal *signal = [RACSignal createSignal:^ RACDisposable * (id subscriber) { [subscriber…
jack
  • 1,861
  • 4
  • 31
  • 52
0
votes
2 answers

Defer RACSignal until UIScrollView is not dragging, tracking or decelerating

Is this OK? - (RACSignal *)deferRefreshSignalUntilScrollViewIsNotBusy:(RACSignal *)infiniteSignal { return [RACSignal createSignal:^RACDisposable *(id subscriber) { __block BOOL disposed = NO; RACDisposable…
hfossli
  • 22,616
  • 10
  • 116
  • 130
0
votes
1 answer

Buffer signals before particular signal occurs

I wonder if it's possible to accumulate results of signals happening between nexts of a particular signal. Similar to [[[RACSignal combineLatest:@[signal1, signal2, signal3]] takeUntil:signal4] subscribeNext:^(id x) { // ... …
Sash Zats
  • 5,376
  • 2
  • 28
  • 42
0
votes
1 answer

Replace item by index in sequence

I guess this should be really stupid, but I'm currently doing it this way: array = [[[array rac_sequence] map:^id(id value) { return [array indexOfObject:value] == indexToChange ? newValue : value; }] array]; But I'm sure there should be a…
0
votes
1 answer

ReactiveCocoa: Immediately send the latest value when there's a new subscription

I have a bunch of manual RACSubject properties in a particular view model; I am calling sendNext at certain points in the code, and I want new subscribers to these signals to immediately have their subscribeNext block be called with the latest value…
Harry
  • 3,076
  • 4
  • 28
  • 44
0
votes
1 answer

How can I subscribe to two signals and access their latest values without using nested subscriptions?

In my current situation I can get by with doing this: [isFooSignal subscribeNext:^(NSNumber *isFoo) { [isBarSignal subscribeNext:^(NSNumber *isBar) { if ([isFoo boolValue]) { if ([isBar boolValue]){ // isFoo…
Paul Young
  • 1,489
  • 1
  • 15
  • 34
0
votes
0 answers

RACObserve property with custom getter

I would like to observe the following property… @property (nonatomic, assign, readonly, getter = isConnected) BOOL connected; with the following code… RACSignal *connectedSignaler = RACObserve(communicationManager, connected); It does not work…
Onato
  • 9,916
  • 5
  • 46
  • 54
0
votes
2 answers

Unit-testing a simple usage of RACSignal with RACSubject

(I may be using this in a totally incorrect manner, so feel free to challenge the premise of this post.) I have a small RACTest app (sound familiar?) that I'm trying to unit test. I'd like to test MPSTicker, one of the most ReactiveCocoa-based…
cbowns
  • 6,295
  • 5
  • 47
  • 64
0
votes
1 answer

Reactive Cocoa - listening for notifications & memory management

I would like to know if someone else had some issue with Reactive Cocoa listenForNotification method. I'm experiencing a retain cycle using the following code and my viewController dealloc method is never called. If I don't listen for that…
Barbara R
  • 1,057
  • 5
  • 18
0
votes
1 answer

Why is my Reactive Cocoa not being called to check textfield for changes?

Im new to RCA. I found this tut online ReactiveCocoaSamurai Its pretty simple...In the original project they separate the model from the view controller, as they should :) But when I try to do it, I can't bind (or connect) the view controller…
marciokoko
  • 4,988
  • 8
  • 51
  • 91
0
votes
1 answer

View Controller state update on model update with ReactiveCocoa

As I'm slowly trying to wrap my head around ReactiveCocoa I wrote this piece of code and I'm fairly sure there's a better way to solve my problem. I'd appreciate input on how to improve / redesign my situation. @weakify(self); [RACObserve(self,…
pkluz
  • 4,871
  • 4
  • 26
  • 40
0
votes
2 answers

Combining signals but just subscribe when first one changes

I want to combine the rac_signalForControlEvent on a UIButton with some combined textFields signals like so: [[[[self.loginButton rac_signalForControlEvents:UIControlEventTouchUpInside] combineLatestWith:textFieldsCombinedSignal] …
0
votes
1 answer

RACSignal not being generated whenever UITextField is reset using UIButton

I've UITextField, UIImageView and UIButton in my UIView. I've a RACSignal that prints the textbox field value using NSLog upon subscription. Also, the UIImageView acts as an error indicator. The code snippet is shown below: [username.rac_textSignal…
TryinHard
  • 4,078
  • 3
  • 28
  • 54
0
votes
1 answer

How get return value of the RacSignal to

I have a beginner's question regarding the ReactiveCocoa. I want to return the value of shouldPerformSegueWithIdentifier method based on user interaction with UIAlertView. That's what I have so far, obviously it doesn't work. How should I…
Janusz Chudzynski
  • 2,700
  • 3
  • 33
  • 46
0
votes
1 answer

How send objects from a array in reactivecoccoa (and wait for each one)?

I need to sync several tables in sqlite from data from parse. I setup ReactiveCoccoa for it. However, I don't know how wait for the sync of one table before start the next. This is what I have now: -(RACSignal *) syncTable:(NSString *)name…
mamcx
  • 15,916
  • 26
  • 101
  • 189