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
7
votes
1 answer

RACObserve not working

I'm trying to observe a property in my ViewModel, and then update a label with it's value using ReactiveCocoa, but it's not updating. Here's what I got: ViewModel var amount: NSDecimalNumber ViewController RAC(self.amountLabel, "text") <~…
diogocarmo
  • 960
  • 1
  • 11
  • 30
7
votes
2 answers

What is the reason of @strongify

In ReactiveCocoa there is macro to prevent retain cycle @weakify and @strongify. From my understanding @weakify do something like what I usually do that is create __weak reference for using in the block, but what about @strongify? Why do I need to…
sarunw
  • 8,036
  • 11
  • 48
  • 84
7
votes
1 answer

rac_signalForSelector: needs empty implementation

I have a class that implements the UICollectionViewDelegate protocol. I'm using rac_signalForSelector: to register selection like this: [self rac_signalForSelector:@selector(collectionView:didSelectItemAtIndexPath:)] but it only fires if I leave in…
Grav
  • 1,714
  • 14
  • 27
7
votes
1 answer

Retrying an asynchronous operation using ReactiveCocoa

I'm using ReactiveCocoa signals to represent calls to RESTful backend in our system. Each RESTful invocation should receive a token as one of the parameters. The token itself is received from authentication API call. All works fine and we're now…
Sergey Mikhanov
  • 8,880
  • 9
  • 44
  • 54
7
votes
1 answer

Best Practice for Instrumenting RACSignal

I've been tasked with adding some instrumentation logic to an app to track the latency of various API calls. I'm struggling to come up with a clean, non side-effecting way to add timing instrumentation to methods that return RACSignal's (deferred…
7
votes
1 answer

RACChannel: not seeing the two-way binding I expected

(Open for comment from ReactiveCocoa guys on GitHub as well.) I'm trying out ReactiveCocoa in a very simple RACTest (source is on GitHub) application in an attempt to firm up my theoretical understanding by actually using it. I've got a RACChannel…
cbowns
  • 6,295
  • 5
  • 47
  • 64
7
votes
3 answers

Reactive Cocoa - UITextView's rac_textSignal doesn't get called when programmatically setting text

I'm implementing a chat UI, and using Reactive Cocoa to adjust the chat bubble's size as the user types. Currently, I'm updating the UI's layout based on the textview's rac_textSignal. Everything's working great - except for one bit: when the user…
bryanjclark
  • 6,247
  • 2
  • 35
  • 68
7
votes
2 answers

Error block not called while using ReactiveCocoa

For some reason I am not getting the error message to come through. (I've simplified the code here to get straight to the point.) // Send an error message _loginButton.rac_command = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) { …
drhr
  • 2,261
  • 2
  • 17
  • 35
7
votes
1 answer

Approach to Reactifying delegate methods with side effects

Just trying to wrap my head around the ReactiveCocoa approach to certain situations. I have a situation where a segment controller swaps out children view controllers. I need to accomplish a couple things here: When moved to the parent controller,…
Bob Spryn
  • 17,742
  • 12
  • 68
  • 91
7
votes
1 answer

Use RACCommand with Asynchronous Network Operation

I'm using UAGitHubEngine to access GitHub's API. I want to write a functional reactive app to fetch some data. I'm relying on on the code here to set up an asynchronous network request. What I'm looking for is the team id of some team named…
Ash Furrow
  • 12,391
  • 3
  • 57
  • 92
6
votes
1 answer

ReactiveSwift: How to observe UIView isHidden?

I'd like to show B UIView iff A UIView is visible. I used ReactiveCocoa 2 in objective-c and tried to find a similar way to observe isHidden property of UIView in ReactiveSwift. I'm still trying to learn the framework and its usage, but couldn't…
REALFREE
  • 4,378
  • 7
  • 40
  • 73
6
votes
2 answers

Swift extension clause where this or that

I want an extension for two classes UITextField and UITextView and the code is identical, but I have trouble coming up with an extension that will work for them both. I am using ReactiveCocoa and I currently have this import UIKit import…
Filuren
  • 661
  • 2
  • 7
  • 19
6
votes
2 answers

How to remove observer using ReactiveCocoa?

How to stop receiving new name after some event? [RACObserve(self, username) subscribeNext:^(NSString *newName) { if ([newName isEqualToString:@"SomeString"]) { //Do not observe any more } }]; P.S. Sorry for obvious question, but…
serj
  • 301
  • 4
  • 10
6
votes
1 answer

ReactiveCocoa rac_valuesForKeyPath doesn't work in Swift

I'm trying to adopt ReactiveCocoa in my iOS application written in Swift. Unfortunately, it looks like rac_valuesForKeyPath doesn't work as expected. Here's the example: class Source: NSObject { var observable: String = "" …
mindz_eye
  • 73
  • 6
6
votes
2 answers

when using @weakify get error unexpected '@' in the program

When using @weakify, I get error unexpected '@' in the program. Am I missing some .h files? I already imported ReactiveCocoa.h. Is there any thing I should do ? - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if…
benoitcn
  • 149
  • 1
  • 12