Questions tagged [racsignal]

42 questions
1
vote
0 answers

How can I create a synchronous method from a block in iOS

I am trying to return an NSArray after retrieving the data from Firebase. So due to several reasons, I need to have this method be synchronous rather than asynchronous. I've tried using RACSignal but I'm not sure how I can convert it to an NSArray.…
Eric Chuang
  • 1,017
  • 9
  • 28
1
vote
1 answer

Retrying RACObserve until success

I have RACObserve block and I want to retry calling until it is successfully returns. So it won't show the Error message, but it will retry to fetch. Thanks for help! [[[[RACObserve(self, currentLocation) ignore:nil] …
Anton Chuiko
  • 235
  • 2
  • 10
1
vote
1 answer

When should/must I declare/instantiate ReactiveCocoa objects as stored properties versus local variables?

(Applies to ReactiveCocoa 4 or maybe 3) In most examples and cases I have seen, ReactiveCocoa objects like MutableProperty or SignalProducer that are involved in hooking up the user interface to data are at least instantiated…
tacos_tacos_tacos
  • 10,277
  • 11
  • 73
  • 126
1
vote
2 answers

What's the best way to reset a timer signal?

I need to fetch data from server every 5 minutes. If I do pull down refresh, also need to fetch data from server, and reset the timer. Below code is the solution now, looks works fine. Just wonder how to simplify the code? Probable there's better…
JerryZhou
  • 4,566
  • 3
  • 37
  • 60
1
vote
1 answer

How might I use ReactiveCocoa/RACSignal to "RACify" a UIApplicationDelegate lifecycle event like didFinishLaunchingWithOptions?

I am wondering how I might go about using the ReactiveCocoa library to RAC-ify UIApplicationDelegate lifecycle events. Since the most important one is - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary…
1
vote
1 answer

How to create a looping RACSignal with RACScheduler

Is there a way to create a scheduled RACSignal that emits value every interval of time ? I'm wondering if there is a way other than creating a dispatch timer ? or some kind of for loop.
Edward Ashak
  • 2,411
  • 2
  • 23
  • 38
1
vote
2 answers

Dispose combined reactive cocoa signals

I have created a app using reactive cocoa signals. In my app I have created some RacSignals and then merged the signals into a single signal and subscribed to it. Now if User logs out, I want a way to cancel all the signals that I have merged. Is…
user3168555
  • 81
  • 1
  • 4
1
vote
1 answer

Why returned from flattenMap empty does not trigger subscribeCompleted

I transform any new value from signal with flattenMap, and I want to stop process based on some condition, not with error, but with completed state. Mentioned below code does not allow to do this. It just filters some value. How can I complete from…
Igor Palaguta
  • 3,579
  • 2
  • 20
  • 32
1
vote
1 answer

RACSignal and replayLazily. How can I handle errors?

This works brilliantly... @interface Hello : NSObject @property (nonatomic, strong, readonly) RACSignal *signal; @end @interface Hello () @property (nonatomic, strong, readwrite) RACSignal *signal; @end @implementation Hello -…
hfossli
  • 22,616
  • 10
  • 116
  • 130
1
vote
1 answer

Return RACSignal method in Swift

I have the following method in Obj-C: - (RACSignal *)fetchCurrentConditionsForLocation:(CLLocationCoordinate2D)coordinate { NSString *urlString = [NSString…
gotnull
  • 26,454
  • 22
  • 137
  • 203
1
vote
1 answer

Array of RACSignals which sends completed or error on first

I'm sure there's an easier way? Or that it already exists? + (RACSignal *)totallyCombinedSignalOfSignals:(NSArray *)signals { return [RACSignal createSignal:^RACDisposable *(id subscriber) { RACCompoundDisposable…
hfossli
  • 22,616
  • 10
  • 116
  • 130
1
vote
2 answers

If a RACSignal sends next can I wrap it in something which sends completed instead?

A very simple question and I'm overseeing probably a key method in RAC. Say I've got this simple signal RACSignal *signal = [[RACSignal return:@"hello"] delay:10] How can I without changing above code create a new signal which sends completed when…
hfossli
  • 22,616
  • 10
  • 116
  • 130
0
votes
1 answer

The command is disabled and cannot be executed

So, when I trying to fetch some data, RACCommand return this error. I have a picker for example and when user scroll it, app get data from server and show them, but if user scroll fast, (previous operation in progress) RACCommand get this…
dev.nikolaz
  • 3,184
  • 3
  • 19
  • 32
0
votes
1 answer

RACSignal: RACSignal code is not executed

Is there a willing soul who could kindly help me with this problem? This is my scenario: I need to upload form attachments to the server. So here are the steps: Retrieve attachment headers from server using Web service. Match the attachment header…
user1309226
  • 739
  • 1
  • 10
  • 31
0
votes
1 answer

RACSignal: Handling incompatible block pointer types

I'm new to Reactive Cocoa and I'm wondering if someone could help me with this problem: Here's the code snippet causing me trouble: [[[self getFormItemAttachmentHeaders:listName topListItemID:form.topListItemID …
user1309226
  • 739
  • 1
  • 10
  • 31