Questions tagged [rx-cocoa]

238 questions
3
votes
2 answers

Handling circular style events on observable sequence RxSwift

I would like to know the best possible way to handle the following situation, I have tried an approach as it will be described but I have encountered an issue of events calling each other repeatedly in a circular way hence it causes stackoverflow I…
Mussa Charles
  • 4,014
  • 2
  • 29
  • 24
3
votes
1 answer

RxCocoa RxSwift 'debounce' is deprecated: Use DispatchTimeInterval overload instead

How to convert deprecated debounce code to use DispatchTimeInterval? Here is the deprecated code: self.myObservable.asDriver().debounce(2).drive(onNext: {(v) in doSomething() }).disposed(by: self.disposeBag)
Timo Tanila
  • 105
  • 1
  • 8
3
votes
2 answers

Prevent redundant operations in RxSwift

I'm starting my adventure with RxSwift, having small experience with React in js already. I think that my problem is common, but I'm not sure how to describe it in concise abstract way, so instead I will describe it on the example. I'm building iOS…
user121882
  • 151
  • 4
3
votes
1 answer

Which is better Driver and Signal for UIButton tap event?

I'm new to RxSwift and RxCocoa. In my project, UIButton tap event is handled with rx.tap.asDriver() in many places but I wander that Signal is better in that case. My recognition is: Driver is for state or variable Signal is for event Please give…
Yuya Matsuo
  • 258
  • 1
  • 5
  • 11
3
votes
1 answer

Differences between "Share Side effect" and "Share Resources"

I'm studying RxSwift and RxCocoa. There are these explanations in the official document. Share side effect Share resource Are they the same? If there is a difference, what difference is there? I don't understand just the explanations in the…
3
votes
1 answer

In RxCocoa/RxSwift, how to observe BehaviorRelay<[object]> array size changed

I'd like to subscribe to a BehaviorRelay<[object]>, and I'd like to execute some functions whenever we append or remove elements. I've used the distinctUntilChange method BehaviorRelay<[object]>.asObservable().distinctUntilChanged{ $0.count !=…
Difeng Chen
  • 155
  • 1
  • 1
  • 9
3
votes
1 answer

RxSwift withLatestFrom with resultSelector doesn't compile

I have a Driver of type Bool and a BehaviorRelay of type Page (which is a custom enum). enum Page { case option1(CustomClass1, CustomClass2) case option2(CustomClass3) case option3(CustomClass4) var property1: CustomClass2? { …
Charlotte1993
  • 589
  • 4
  • 27
3
votes
1 answer

How do I combine observable loop results to array in RxSwift?

I have a simple stream that has numbers. I want to do some mathematical operations and then collect results sequentially in an array. How can i do that ? func test (number : Int) -> Observable { let obs2 = Observable.create { (obs)…
3
votes
1 answer

RxSwift - Why wrap ControlProperty trait into a Driver?

In the official RxSwift documentation, it's described that traits Driver and ControlProperty share many similarities between them (can't error out, observe occurs on main scheduler, share and replay side effects), but at the same time in the example…
3
votes
1 answer

How to unit test RxCocoa BehaviorRelay

I am starting out with unit testing RxSwift Driver. And I am having issues testing a Driver. This is the code structure of my ViewModel: import Foundation import RxSwift import RxCocoa class LoginViewViewModel { private let loginService:…
PoiseGood
  • 33
  • 4
3
votes
3 answers

RxSwift - make one UI element hidden/not hidden according to other element

Im using RxSwift and RxCocoa in my project. I have some UITextField named "lastNameTF", and there is a UILabel name "lastNameTitle". I wanna know if there is any way to set the isHidden value of lastNameTitle always be equal to isHidden value of…
Asi Givati
  • 1,348
  • 1
  • 15
  • 31
3
votes
0 answers

How put a custom view on a selected row for an uipickerview rxswift?

I use Pickerview with Rx and i would like to know how you can change view of the selected row with a custom view. i tried on a picker view without RX it works. But the same with Rx and Custom Adapter don't work. Do you have an idea to do this…
3
votes
2 answers

XCode crashes on deploying to Simulator when using RxCocoa

This might be a possible duplicate of Xcode 9 crashes when debugging in swift however since I have a new account I can't comment over there. I'm using XCode 9.1 (9B55) and RxSwift / RxCocoa 4.0.0 I'm trying to migrate my TableView code to RxSwift…
Paul Weber
  • 133
  • 9
3
votes
1 answer

How to implement a queue of serial network calls then processing in RxSwift?

I'm working on an app where I want to achieve the following using RxSwift and RxCocoa Download JSON containing url to X number of files Download file 1, process file 1 Download file 2, process file 2 Download file 3, process file 3 ... etc The key…
Nailer
  • 2,446
  • 1
  • 24
  • 34
3
votes
1 answer

Swift 3: Convert PromiseKit deferred to RxSwift

I'm currently replacing PromiseKit with RxSwift, and need to convert my deferred promise to RxSwift. Current implementation example in PromiseKit: private var deferredDidLayout = Promise<()>.pending() override func layoutSubviews() { …
PAK
  • 431
  • 4
  • 17