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

How do I replace my KVO code with RAC3 and keep my existing models?

I am looking into ReactiveCocoa to improve our Swift code. As a starting point, I would like to bind the text of a label to the transformed value of a property. Basically, I would like to replace some KVO code. So, I have the following…
Bastian
  • 4,638
  • 6
  • 36
  • 55
5
votes
0 answers

RACScheduler crashing with EXC_BAD_ACCESS KERN_INVALID_ADDRESS on NSManagedObject

We have a reoccurring, difficult to reproduce crash in our app using ReactiveCocoa 2.5 We have a background scheduler which we retain during the live time of the application. Whenever we do a network call (using AFNetworking) we deliver the results…
Mike Seghers
  • 1,925
  • 2
  • 16
  • 12
5
votes
3 answers

Issue to inherit UIAlertAction in Swift

Here is my code: class CustomAlertAction: UIAlertAction { init(title : String) { super.init(title: title, style: UIAlertActionStyle.Default) { (action) -> Void in } } } But I got the following compiling error: Must call a…
Bagusflyer
  • 12,675
  • 21
  • 96
  • 179
5
votes
1 answer

ReactiveCocoa retain cycle when passing closure as parameter

I'm using ReactiveCocoa in Swift as followed: registerButton?.rac_signalForControlEvents(UIControlEvents.TouchUpInside).subscribeNextAs(registerButtonTapped) private func registerButtonTapped(button: UIButton){ // Method here } Which creates a…
Antoine
  • 23,526
  • 11
  • 88
  • 94
5
votes
1 answer

How can I convert "SignalProducer" to "SignalProducer" of ReactiveCocoa 3?

I tried creating an instance of Action of ReactiveCocoa 3. let action: Action = Action { _ in if self.flag { return self.fooSignalProducer // SignalProducer } else…
r.izumita
  • 450
  • 1
  • 4
  • 13
5
votes
1 answer

Reactive Cocoa: subscribe only to new values

I'm new to Reactive Cocoa. What I'm trying to achieve is get notified every time property value changes. However, I don't want to get notified when property is set to the same value. Here's some code: self.testProperty = 0; [[RACObserve(self,…
msmialko
  • 1,439
  • 2
  • 20
  • 35
5
votes
2 answers

Memory management in ReactiveCocoa

I've just read a tutorial about ReactiveCocoa. In the "Avoiding Retain Cycles" chapter, the writer says, in order to avoid the retain cycle, we should replace self with bself in the subscribeNext block. However he keeps self in the map block. __weak…
Henry H Miao
  • 3,420
  • 4
  • 20
  • 26
5
votes
2 answers

rac_signalForControlEvents not signaling in a UICollectionViewCell

I have a bunch of UICollectionViewCells containing buttons. For some reason, my signal refuses to fire when a button is inside of a UICollectionViewCell. Switching to the normal addTarget:action:forControlEvents: will work, but not the RAC signal.…
MishieMoo
  • 6,620
  • 2
  • 25
  • 35
5
votes
1 answer

Combining multiple signal not working using Reactive Cocoa

I am following this tutorial: http://www.raywenderlich.com/62699/reactivecocoa-tutorial-pt1. It is working for username and password field. I am trying to create sign up form which contains three fields: email, password, confirmPassword. I have…
regeint
  • 888
  • 2
  • 17
  • 38
5
votes
1 answer

How is [UITextField rac_newTextChannel] used to two-way bind UITextField text to a model object in ReactiveCocoa?

Say I have the following: UITextField *textField = [[UITextField alloc] init]; and a model object: JSModel *model = [[JSModel alloc] init]; The following will give me a two-way binding (perhaps there are disadvantages with this approach that I'm…
codeperson
  • 8,050
  • 5
  • 32
  • 51
5
votes
2 answers

How can I subscribe to the completion of a command's execution signals without a nested subscription?

I tried the following without success. The equivalent using -subscribeNext: works as expected. // A [[_viewModel.loginCommand.executionSignals flatten] subscribeCompleted:^{ NSLog(@"A"); }]; My only working implementation is as follows: //…
Paul Young
  • 1,489
  • 1
  • 15
  • 34
5
votes
1 answer

What does it mean that RACStream represents a monad?

From the doc RACStream represents a "Monad"? Could somebody explain what this specifically means in the context of RACStream. I looked up the functional meaning on wiki but I am having difficulties seeing how it benefits Reactive-Cocoa and why this…
jack
  • 1,861
  • 4
  • 31
  • 52
5
votes
0 answers

UITableViewCell binding to Data Model (updates driven by FetchedResultsController)

I'm attempting to have my individual UITableViewCells: I'd love to have the initial values of the model brought over to their UI representation as well as after the user makes a change have the new UI value brought back to the model. Let's just…
yo.ian.g
  • 1,354
  • 2
  • 14
  • 21
5
votes
1 answer

Binding a UISwitch's state to a model with ReactiveCocoa

I am trying to bind a UISwitch's on state to a boolean property in my model using ReactiveCocoa. I started with: RACChannelTo(self.switch, on, @NO) = RACChannelTo(self.model, toggle, @NO); This is how I've been binding other views to other parts of…
Andy Molloy
  • 111
  • 2
  • 7
5
votes
2 answers

How to make RACSignal to become hot?

ReactiveCocoa can convert the signal to "hot" signal by calling its -subscribeCompleted:. But I think this method is quite verbose if you do not care about the result (i.e. no subscribers). RACDisposable *animationDisposable = [[self play:animation]…
HKTonyLee
  • 3,111
  • 23
  • 34