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
17
votes
4 answers

How do I create a ReactiveCocoa subscriber that receives a signal only once, then unsubscribes/releases itself?

I'm currently registering a subscriber to a property signal like this: [RACAble(self.test) subscribeNext:^(id x) { NSLog(@"signal fired!"); }]; The default functionality is that it fires every single time self.test is changed, but I just…
zakdances
  • 22,285
  • 32
  • 102
  • 173
16
votes
1 answer

MVVM and pushing a ViewController: where to initialize the next ViewController and ViewModel, and push on the new view?

I'm thinking through the structure of a very simple ViewModel and ViewController for a test application. I have something akin to: FirstViewController.m: - (IBAction)launchButtonSelected:(id)sender { [self.viewModel…
cbowns
  • 6,295
  • 5
  • 47
  • 64
16
votes
2 answers

Meaning of Objective-C macros prefixed with an at (@) symbol

The ReactiveCocoa framework makes use of weakify and strongify macros, both of which are preceded by an '@' symbol. Here's an example (From this file). - (RACSignal *)rac_textSignal { @weakify(self); return [[[[RACSignal …
ColinE
  • 68,894
  • 15
  • 164
  • 232
16
votes
1 answer

When to use RACReplaySubject vs. RACMulticastConnection?

Using ReactiveCocoa, there seem to be two ways to have subscribers receive the same values from a signal, rather than re-triggering whatever operation generates those values: Via RACReplaySubject or RACMulticastConnection. Here are the header docs…
Poulsbo
  • 648
  • 5
  • 18
15
votes
1 answer

RxSwift -- MainScheduler.instance vs MainScheduler.asyncInstance

What is the difference between using RxSwift's MainSchedule.instance and MainSchedule.asyncInstance within the context of observeOn?
udi80z
  • 153
  • 1
  • 4
14
votes
1 answer

Splitting an RACSignal to eliminate state

I'm using ReactiveCocoa to update a UILabel whilst a UIProgressView counts down: NSInteger percentRemaining = ...; self.progressView.progress = percentRemaining / 100.0; __block NSInteger count = [self.count]; [[[RACSignal interval:0.05…
13
votes
3 answers

Getting "use of undeclared type 'NoError'" with ReactiveCocoa

I am trying to learn ReactiveCocoa and have a hard time getting started. I keep hitting minor bumps as API and tutorials seems to be outdated quickly. Maybe I have the wrong impression. Just trying to follow this I do not seem to have NoError. It…
Filuren
  • 661
  • 2
  • 7
  • 19
12
votes
2 answers

ReactiveCocoa: Subscribe only to new values

I've created an event subscriber in viewDidLoad, as follows: [RACObserve(_authenticationView.passwordInput.textField, text) subscribeNext:^(NSString* text) { //handle this }]; This fires whenever the textField.text property changes…
Jasper Blues
  • 28,258
  • 22
  • 102
  • 185
12
votes
1 answer

Cache invalidation in ReactiveCocoa

I'm still wrapping my head around RAC and FRP in general - currently struggling to figure out how to implement a pattern I've commonly had to use elsewhere. Let's say I'm making a flashcard app, and the main screen is a list of my decks of cards.…
aehlke
  • 15,225
  • 5
  • 36
  • 45
11
votes
3 answers

Combine previous value using Combine

How can I rewrite ReactiveSwift/ReactiveCocoa code using Combine framework? I attached screenshot what combinePrevious mean from docs. let producer = SignalProducer([1, 2, 3]).combinePrevious(0) producer.startWithValues { value in …
Taras
  • 1,485
  • 1
  • 16
  • 31
11
votes
1 answer

ReactiveSwift Simple Example

I've read the documentation, gone through their wonderful Playground example, searched S.O., and reached the extent of my google-fu, but I cannot for the life of me wrap my head around how to use ReactiveSwift. Given the following.... class…
forgot
  • 2,160
  • 2
  • 19
  • 20
11
votes
5 answers

initiate Google Signin without the GIDSignInButton but programmatically

Is there a way to launch the Google SignIn programmatically without pressing on the GIDSignInButton ? I'm trying to wrap a signal around hitting google api where the user must log in. sort of : googleSignInSignal().then(getPersonalDataSignal)
Edward Ashak
  • 2,411
  • 2
  • 23
  • 38
11
votes
2 answers

Perform action on the hour, every hour, with ReactiveCocoa

Trying to follow the best practices of ReactiveCocoa to update my UI on the hour, every hour. This is what I've got: NSDateComponents *components = [[[NSCalendar sharedCalendar] calendar] components:NSMinuteCalendarUnit fromDate:[NSDate date]]; //…
Ash Furrow
  • 12,391
  • 3
  • 57
  • 92
10
votes
4 answers

How do you get a signal every time a UITextField text property changes in ReactiveCocoa 5

How do you get a signal from both user-initiated and programmatically made changes to UITextField text property? By using continuousTextValues only reports a signal when the user has initiated the change. If you set textField.text programmatically,…
10
votes
1 answer

How to make basic bindings in ReactiveCocoa 3 and 4

I've been reading up on ReactiveCocoa v3 lately and I'm struggling with just setting up basic stuff. I've already read the changelog, the tests, the few SO questions and the articles by Colin Eberhardt on the subject. However, I'm still missing…
Steffen D. Sommer
  • 2,896
  • 2
  • 24
  • 47
1
2
3
57 58