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
2 answers

How can I do a two-level sort of an incoming signal using ReactiveCocoa?

I have been tooling around with ReactiveCocoa and I've come upon an interesting problem. I can envision any number of ugly, stateful solutions, but I'm pretty confident there is an elegant, functional way that's just not materializing in my head for…
ipmcc
  • 29,581
  • 5
  • 84
  • 147
5
votes
1 answer

Merge Two RACSignals, Complete on First Completion

I have two RACSignals one of which is a timer and the other one indicates there's work to do. Since the work indication is sometimes unreliable, there's the timer, which takes care that work will be done periodically if the precise notifications…
Johannes Weiss
  • 52,533
  • 16
  • 102
  • 136
5
votes
2 answers

What is the preferred way to create a signal of signals to combine to signals and complete when either completes or errors?

I have success notification and a failure notification that come through NSNotificationCenter. I wrote some tests to figure out how to combine the signals from those two notifications into one signal that provides an error when the failure…
Jon
  • 462
  • 4
  • 13
5
votes
1 answer

Recursive -flattenMap: with Reactive Cocoa + OctoKit (fetching dynamic object graph from web service)

I'm trying to pre-fetch an object graph of files in a Github repository using Octokit which depends on Reactive Cococa. I'm running into an issue creating a signal that will drill down, recursively, until there are no more directories to be fetched.…
5
votes
3 answers

How to get current value from ReactiveCocoa signal?

I have signal returning NSNumber: RACSignal *signal = .... Then in some place of code I want to get value of signal in the moment of execution, something like: NSNumber *value = [code that extracts current value of signal];
Leszek Zarna
  • 3,253
  • 26
  • 26
5
votes
2 answers

Refactoring into ReactiveCocoa

So I have just recently started with ReactiveCocoa, and I figured the best way to learn would be just to jump right in and start refactoring some existing code that I have. I was wanting to get some critique and make sure I am heading in the right…
terry lewis
  • 672
  • 1
  • 5
  • 13
5
votes
1 answer

How to use ReactiveCocoa with Gesture Recognizers

I'm building an application using ReactiveCocoa. The top view is a menu which can be pulled down then pushed back up. I have to use two different gesture recognizers – one for pulling down and one for pushing back up. Only one can be enabled at a…
Ash Furrow
  • 12,391
  • 3
  • 57
  • 92
4
votes
1 answer

Why does wrapping a ReactiveSwift MutableProperty in a Property cause a leak?

Here's a Swift class that uses ReactiveSwift, wrapping a MutableProperty in a Property, and adding a subscription to that Property in a ScopedDisposable: class Leaker { let mutableProperty = MutableProperty(0) var wrapperProperty:…
Luke
  • 7,110
  • 6
  • 45
  • 74
4
votes
3 answers

Can a signal observer get access to the last emitted value of a ReactiveCocoa signal?

I'm starting using ReactiveCocoa and I'm still struggling with some basic concepts: My app starts listening for geolocation data (init in my view model) My app emits a signal with my current location (didFindCurrentPosition is called) My view…
Mick F
  • 7,312
  • 6
  • 51
  • 98
4
votes
2 answers

ReactiveCocoa 5, ReactiveSwift network sub-request handling & best practice

I'm trying to find best practice to handle multiple sub-requests per each value got from parent request. I'm trying to use the same logic as here - Reactive Cocoa 5 and ReactiveSwift network requests handling, but have some problems. What we have…
Stas Ivanov
  • 917
  • 1
  • 10
  • 22
4
votes
2 answers

Signal: Collect values over time interval

This might be a trivial question but I'm unable to find a solution to this seemingly easy task. As I'm new to ReactiveSwift and reactive programming I might simply miss something obvious. Basically what I want to do is something like…
Sascha Wolf
  • 18,810
  • 4
  • 51
  • 73
4
votes
1 answer

ReactiveSwift - Updating Value Of MutableProperty?

As a followup to this question, which received this fantastic answer, and using the following example... class Model { let mapType = MutableProperty(.standard) } class SomeViewController: UIViewController { let viewModel: Model …
forgot
  • 2,160
  • 2
  • 19
  • 20
4
votes
1 answer

Bind action in uibutton -Reactive Cocoa

I have declared a action as var postAction: Action! now what i want is to trigger this action when the button triggers. triggerBtn.reactive.pressed = CocoaAction(postAction) But can't.How can i trigger some action when a…
user6398734
4
votes
1 answer

Error: 'String' is not convertible to 'String!'

mapView.rac_valuesForKeyPath("userTrackingMode", observer: self).subscribeNextAs { // block handling I get an error 'String' is not convertible to 'String!'. Any suggestions what this may mean? I used to think, that String! is same as String, so…
Nat
  • 12,032
  • 9
  • 56
  • 103
4
votes
3 answers

Handling action from UITableViewCell in MVVM

So I have this BaseCell class which also has this BaseCellViewModel. Of course on top of this lives some FancyViewController with FancyViewModel. The case here is that BaseCell has UIButton on it which triggers this IBAction method - that's fine and…
cojoj
  • 6,405
  • 4
  • 30
  • 52