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

Similar types: Cannot specialize a non-generic definition

I have a Controller where I need to import two pods. import Realm import ReactiveSwift Problem is that both have a type named Property. Now if I use that with importing both pods then it gives me compile time error Cannot specialize a non-generic…
Parth Adroja
  • 13,198
  • 5
  • 37
  • 71
2
votes
2 answers

ReactiveCocoa: Difference between binding to a Signal or a SignalProducer?

The binding operator (<~) takes a BindingSource argument, both Signal and SignalProducer conform to the protocol I would expect an UI element that is bound to a producer wouldn't "receive events" until the producer is started in some way but this…
2
votes
1 answer

ReactiveSwift. Zipping an array of signal producers

I have an array of signal producers that fetch similar objects from the backend like [SignalProducer]. How can I zip them to have array of their results [Object] every time they all are finished? I know there zip operators with…
benchman
  • 115
  • 4
2
votes
3 answers

ReactiveCocoa error "Let 'value' is private and cannot be referenced from an '@inline(__always)' function" since Xcode 8.3 update

I am using ReactiveCocoa for my iOS app, here are the two related lines of my Podfile: pod 'ReactiveCocoa', '5.0.0-alpha.3' pod 'ReactiveObjC' Since I updated Xcode to version 8.3, I can't compile my code anymore, the compiler throws these errors…
Randy
  • 4,335
  • 3
  • 30
  • 64
2
votes
2 answers

MutableProperty containing a dictionary in ReactiveSwift

I am using ReactiveSwift to create a struct containing a dictionary. I want to listen for changes in the dictionary. struct Model { let a: MutableProperty<[String: Int]> = MutableProperty([:]) } However, I'm having a hard time understanding how…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
2
votes
2 answers

How do I bind a single SignalProducer to multiple UI components?

I am using Swift, ReactiveSwift, and ReactiveCocoa. Assuming I have a single SignalProducer, is there a way for multiple UI components to update when an Event is produced? eg. let sp = SignalProducer = // ... label1.reactive.text <~…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
1
vote
1 answer

How to map a completed event to an interrupt event when take(duringLifetimeOf:) happened in ReactiveSwift

For example, I want to send a request in my viewModel, if the viewModel is dealloc. The request signal should send interrupt event. This is my code func request() -> SignalProducer { let request: SignalProducer = .....…
Yanni
  • 580
  • 2
  • 6
  • 21
1
vote
1 answer

Why does Observer in ReactiveSwift have send method?

I feel confused when I see the sample code from ReactiveSwift, because intuitively observer is expected to receive events. Why does Observer is designed to have send(_:) method? // Signal.pipe is a way to manually control a signal. // the returned…
ChaseChoi
  • 101
  • 5
1
vote
1 answer

Is there a cold/hot signal in swift Combine(likes SignalProducers /Signals in ReactiveCocoa)?

I recently started using swift's Combine (I've used ReactiveCocoa before), I'm wondering if there is a concept of cold and hot signals also in Combine? Dose Publisher is equal to cold signals(SignalProducers), and No hot signal in Combine? Thanks~
ImWH
  • 820
  • 1
  • 7
  • 20
1
vote
1 answer

ReactiveSwift Action in Swift Combine

Is there an alternative to ReactiveSwift Action in Swift Combine? If not, how could it be implemented? I am not very familiar with Swift Combine yet and could't find it anywhere.
eja08
  • 4,600
  • 3
  • 13
  • 19
1
vote
2 answers

Combine 2 PublishSubject's and emit with Observable.combineLatest

I have 2 separate collections of data in my service. Featured and Standard content. I have 2 api's calls I make to return these items. They can be consumed separately, however I also have use case when I would like to take both sets of data, provide…
Teddy K
  • 820
  • 1
  • 6
  • 17
1
vote
1 answer

Bind the view model with view using Reactive Swift

I have been following reactive swift recently to realise it's functionality. This is the playground info that is currently…
1
vote
1 answer

Reactive Cocoa MVVM Initialization

So I'm fairly new to the concepts of Reactive Swift/Cocoa & MVVM. I'm wondering If I have the ViewModel initialized in the wrong place. Model struct userInfo { let name: String let birthday: Date init(name: String, birthday: Date) { self.name…
AlrightyRob
  • 163
  • 13
1
vote
1 answer

How to turn a Property into a SignalProducer?

Given let numberOfSneezes = Property(0) how do i turn numberOfSneezes.producer into this type of producer let sneezeNumberProducer: SignalProducer ? I know numberOfSneezes.producer is not going to send any errors, but i…
1
vote
2 answers

Reactive Swift consume live data from API - need basic example

I’m new to RxSwift and I’m looking for a basic example of how to print in console live data streaming from an backend. I have a backend which is streaming some dummy data every 1 second, I can see it with a curl request and I want to be able to…
ibercode
  • 1,264
  • 3
  • 17
  • 29
1 2
3
8 9