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

Understanding ReactiveCocoa and MVVM in my ReactiveCocoa test project

I've written a very simple ReactiveCocoa test application to try my hand at coding in RAC (rather than just reading about it endlessly). It's on Github, and I wanted to get some specific questions about it answered. I'll link to the code components…
cbowns
  • 6,295
  • 5
  • 47
  • 64
6
votes
2 answers

ReactiveCocoa: disposing of a repeating signal

I'm trying to understand how to dispose of a RACSignal that is scheduled to run on a background thread. // Start button @weakify(self); [[self.startButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(UIButton *sender) { …
Mike
  • 63
  • 1
  • 7
6
votes
1 answer

Using ReactiveCocoa to track UI updates with a remote object

I'm making an iOS app which lets you remotely control music in an app playing on your desktop. One of the hardest problems is being able to update the position of the "tracker" (which shows the time position and duration of the currently playing…
oliland
  • 1,299
  • 11
  • 23
6
votes
2 answers

Why the signal is called twice in ReactiveCocoa?

I'm implementing my first code with https://github.com/ReactiveCocoa/ReactiveCocoa. Is for login a user. The line [subscriber sendNext:user]; is called twice, but I expect to be only one. And the map is not called at all (so autologin is never…
mamcx
  • 15,916
  • 26
  • 101
  • 189
6
votes
1 answer

Stop publishing when there are no subscribers and auto start when there are subscribers

How would I implement a RACSignal that would stop publishing when there are no subscribers to it and auto start when there are subscribers? Here is a scenario: Let us say I have a currentLocationSignal in the AppDelegate. My LocationViewController…
prabir
  • 7,674
  • 4
  • 31
  • 43
5
votes
1 answer

How can I transform a signal with errors into a NoError one with ReactiveSwift? (and be elegant)

What is the most elegant way to transform my ReactiveSwift's SignalProducer into a Signal? Most of the time, my signal producer is the result of a network call, so I want to split the results into two cases: if a value…
Mick F
  • 7,312
  • 6
  • 51
  • 98
5
votes
1 answer

How to observe property changed in Swift with ReactiveCocoa

I am writing Swift with the new ReactiveCocoa + ReactiveSwift. I am trying to do something like the following (in ReactiveCocoa 2.5) with the new ReactiveCocoa framework: [[RACObserve(user, username) skip:1] subscribeNext:^(NSString *newUserName) { …
Robert Huang
  • 109
  • 1
  • 7
5
votes
1 answer

RxSwift : how to Unit Test Searching in Searchbar and displaying results in tableview

So ive been using Rxswift for a while and its been working well. Ive managed to get all my code under test but Im struggling to figure out how to test searching with searchbar.rx.bindTo . There are many tutorials of how to use RxSwift for searching…
pjapple15
  • 299
  • 4
  • 10
5
votes
1 answer

Reactive Cocoa 5 and ReactiveSwift network requests handling

I'm trying to figure out if network requests handling can be implemented suitable to my needs using ReactiveSwift and RAC5. Under topic Migrate from RACSignal to ReactiveSwift or RAC5 I was told it can be done with SignalProducer, but digging deeper…
Stas Ivanov
  • 917
  • 1
  • 10
  • 22
5
votes
1 answer

How to combine multiple SignalProducers?

Suppose I have a bunch of SignalProducers in an array: [SignalProducer] How do I combine them to get one SignalProducer that waits for all of them and gets all the Cars? SignalProducer<[Car], NSError> Use case: Do a network request…
code-ninja-54321
  • 509
  • 4
  • 12
5
votes
1 answer

Dwifft & ReactiveCocoa

I love Dwifft but I would love even more to use it with ReactiveCocoa to help reduce code complexity in my collection view controllers even more. Currently, I have a helper class that takes an instance of SignalProducer<[[T]]> where T: Equatable (so…
barndog
  • 6,975
  • 8
  • 53
  • 105
5
votes
0 answers

pause signal in ReactiveCocoa

I want a pause or pauseUntil signal in ReactiveCocoa that behaves similarly to skipUntil except instead of just skipping values sent on self until skipUntil receives a trigger signal, I want pause/pauseUntil to conditionally wait AND collect values…
barndog
  • 6,975
  • 8
  • 53
  • 105
5
votes
0 answers

Best practices for ReactiveCocoa with CoreData

So I've been building an app which works heavily on a custom API, I've built all of the core data models in my app based after the returned Models from the API, some of the features change very regularly based on user interaction and I've been…
bevbomb
  • 689
  • 2
  • 12
  • 26
5
votes
1 answer

What's the main difference between ReactiveCocoa and PromiseKit?

ReactiveCocoa use RACSignal and PromiseKit use Promise to wrap values. They can both chain asynchronous works together. What's the main design difference between ReactiveCocoa and PromiseKit?
drinking
  • 1,533
  • 3
  • 15
  • 22
5
votes
1 answer

How to create custom signal in ReactiveCocoa 4?

I have the following setup, a GridView that consists of GridViewCells. GridView class GridView : UIView { var gridViewCells: [GridViewCell] = [] let tapHandler: Position -> () init(frame: CGRect, tapHandler: Position -> ()) { …
nburk
  • 22,409
  • 18
  • 87
  • 132