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
1
vote
1 answer

In ReactiveSwift signal observer sends a signal only when explicitly called from main thread

I am using ReactiveSwift for a while but suddenly encountered a strange bug or something. I am using an MVVM architecture and have a simple view controller and a view model for it. The VM has a single property of type Signal. In the…
Tigran Iskandaryan
  • 1,371
  • 2
  • 14
  • 41
1
vote
1 answer

moya request in background thread

I'm wondering how to make a request in a background thread, what I mean by that is the fetching in a background thread and then come back to the main thread Currently I can go the main thread after the request by calling: .observe(on:…
1
vote
2 answers

how to observe new values of an SignalProducer array

I have a SignalProducer that contains an array, I want to observe only new changes and not get the whole array when I observe it I try flatMap .latest but it does not work Anyone have an idea of how to do that ?
1
vote
1 answer

ReactiveSwift emit elements from an array with a delay between elements

Let's say I have an array of elements [1, 2, 3] and a delay of 5 seconds. I want to emit each element of the array with a pause between the current element emited and the next. Example: Output: [00:00] -- 1 [00:05] -- 2 [00:10] -- 3 I've tried to…
1
vote
2 answers

ReactiveSwift Refresh data

I beginner in ReactiveSwift. This is fetching code in my view model : private let viewDidLoadProperty = MutableProperty(nil) public func viewDidLoad() { disposables += self.weatherFetcher.fetchCurrentWeather().startWithResult {…
1
vote
1 answer

MutableProperty: execute method on value access

I'm using ReactiveSwift + SDWebImage to download/cache userAvatars of an API and then I display them in my ViewControllers. I have multiple ViewControllers which want to display the userAvatar, then they listen to its async loading. What is the best…
Toldy
  • 1,241
  • 1
  • 14
  • 27
1
vote
1 answer

How to interrupt SafeSignal in ReactiveSwift?

Hi I am new to reactive swift. In my new project I am using ReactiveSwift. I am observing value by using SafeSignal variable. I want to interrupt the signal before getting the value. Please help me out in this issue.
Rajesh
  • 124
  • 9
1
vote
2 answers

What difference between using ScopedDisposable and take(during: ...)?

I have View Controller which has some signal and I want to observe values from that signal in viewDidLoad(). I need to dispose that signal when View Controller will be dead: override func viewDidLoad() { super.viewDidLoad() let composite =…
slavabulgakov
  • 31
  • 1
  • 3
1
vote
1 answer

Why can't I observe events in this ReactiveSwift-enabled network workflow?

I'm training myself on using ReactiveSwift for networking and a good use case for this seemed to fetch photos for a location from the Google Places API for iOS. The flow is as follow: Get a list of GMSPlacePhotoMetadata from a google place ID For…
Mick F
  • 7,312
  • 6
  • 51
  • 98
1
vote
1 answer

New versioning NSNotificationCenter in reactive swift

I would like to know below lines of code I mentioned NSNotificationCenter in swift 3.0 can be converted into RxSwif/RxCocoa let imageDataDict:[String: UIImage] = ["image": image] // Post a…
Rajesh
  • 124
  • 9
1
vote
1 answer

Value of type 'UIButton' has no member 'reactive'

I want to use ReactiveSwift. Podfile pod 'ReactiveCocoa', '~> 6.0' $ pod install ViewController.swift: import UIKit import ReactiveSwift class ViewController: UIViewController { @IBOutlet fileprivate weak var button: UIButton! override…
shiba1014
  • 69
  • 5
1
vote
0 answers

Why ReactiveSwift Action just run one time?

I want to implement a simple login feature using ReactiveSwift. Here is my code for ViewController: func setupRac() { viewmodel = SignInViewModel() self.viewmodel.username <~ self.usernameTextField.reactive.continuousTextValues …
t4nhpt
  • 5,264
  • 4
  • 34
  • 43
1
vote
2 answers

ReactiveSwift: how to rebind (remove old bindings, add new)?

I have a view that has to be able to rebind to a new view-model periodically: that means removing the old bindings as well as hooking up the new ones. I have a working solution, but it's not thread-safe and I wonder if there's a more idiomatic way…
Tikitu
  • 679
  • 6
  • 22
1
vote
1 answer

How to compose Actions in ReactiveSwift ("run the first enabled action from this list")

I have two Actions with the same input/output/error types, and I'd like to compose them into a single Action that runs whichever of the two is enabled (with an arbitrary tie-breaker if they both are). Here's my first, failing, attempt: let…
Tikitu
  • 679
  • 6
  • 22
1
vote
1 answer

Converting PromiseKit to Signal & SignalProducer

I'm trying to convert a Promise from PromiseKit into a ReactiveSwift SignalProducer but I'm having trouble coming up with it. Could someone point me in the right direction? Currently I have: extension SignalProducer { func from(promise:…
barndog
  • 6,975
  • 8
  • 53
  • 105
1 2 3
8 9