Questions tagged [reactive-swift]

Anything related to the ReactiveSwift library that brings the reactive programming primitives in Swift

ReactiveSwift is a library that brings the reactive programming approach on Swift. It offers composable, declarative, and flexible primitives that are built around the grand concept of streams of values over time.

This is a pure-Swift implementation of the reactive API. It provides all the nuts and bolts, including Signals, SignalProducers, Properties, Actions and Bindings.

ReactiveSwift documentation

ReactiveSwift project on GitHub

124 questions
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
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,…
8
votes
2 answers

Error with latest ReactiveCocoa Carthage : No such module 'Result'

I'm updating my project to Swift 5 Xcode 10.3. Everything was working fine with the previous Swift version now with the latest ReactiveCocoa 10.0.0 Already tried : Deleting and updating all carthage Deleting derivedData Folder, clean and build
5
votes
1 answer

Differences among flatmap strategies in ReactiveSwift

From the documentation of reactive swift I could understand about Flattening. Examples of which can be found here. In the section Flattening event streams everything has been discussed perfectly. I'm confused about flatmap. According to the docs, it…
Shubhashis
  • 10,411
  • 11
  • 33
  • 48
5
votes
1 answer

Observation event passing in reactiveswift

I've read the docs multiple times and need clarification... Given the snippet below: let signal: Signal //call this observer y signal.take(first: 1).observeValues{ (value) in //intended strong capture on self. this is the only one…
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

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

ReactiveSwift mutable property with read only public access

I have a class with enum property state. This property's value (by value I mean ReactiveSwift.Property's value) needs to be accessed and observed by other classes, but value change should be private. Currently it is implemented in a such way: enum…
iyuna
  • 1,787
  • 20
  • 24
4
votes
3 answers

crash due to `Lock.UnfairLock.lock()` when using `UIRefreshControl` whilst observing `Action.isExecuting`

I'm using a UITableView to display a paginated list and I'm using a UIRefreshControl to indicate that a network request is taking place. However, for some reason self.refreshControl.beginRefreshing()/self.refreshControl.endRefreshing() causes a…
W.K.S
  • 9,787
  • 15
  • 75
  • 122
4
votes
2 answers

ReactiveSwift: How to subscribe to SignalProducer?

I'm trying to learn ReactiveSwift and ReactiveCocoa. I can use Signal and Property pretty well, but I'm having trouble with SignalProducer. As I understand it, SignalProducer is ideal for things like network requests. I set up my API layer to create…
ABeard89
  • 911
  • 9
  • 17
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
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
3
votes
2 answers

ReactiveSwift: Observe Managed Object changes with MutableProperty

My project has CoreData database with 1 root context and multiple sub contexts. I have a ViewModel that contains an Item (NSManagedObject). When I changes something in an Item the persistence is made in the root context and then automatically merged…
6rod9
  • 1,407
  • 12
  • 29
1
2 3
8 9