Questions tagged [rx-swift]

RxSwift's intention is to enable easy composition of asynchronous operations and event/data streams. Use this tag only for questions that are specific to the RxSwift - Reactive Programming paradigm, or those that require code in the language. Use the related tags [ios], [osx], [apple-watch], [cocoa-touch], and [cocoa] for (language-agnostic) questions about the platforms or frameworks.

About Rx and RxSwift

Rx is a generic abstraction of computation expressed through Observable<Element> interface.

RxSwift is a Swift version of Rx.

It tries to port as many concepts from the original version as possible, but some concepts were adapted for more pleasant and performant integration with iOS/macOS environment.

Cross platform documentation can be found on ReactiveX.io.

Like the original Rx, its intention is to enable easy composition of asynchronous operations and event/data streams.

KVO observing, async operations and streams are all unified under abstraction of sequence. This is the reason why Rx is so simple, elegant and powerful.


Resources

2149 questions
0
votes
2 answers

How Can I use the Bind Method in RXSwift?

The following sample code throws an error stating No exact matches in call to instance method 'bind' How can I bind the onNext of my publish subject to my observable? let publish = PublishSubject() // Error Here publish.bind(to:…
dubbeat
  • 7,706
  • 18
  • 70
  • 122
0
votes
1 answer

RxSwift - How does merge handle simultaneous events?

So I have a code that looks something like this: let a = Observable.just("A").delay(.seconds(3), scheduler: MainScheduler.instance) let b = Observable.just("B").delay(.seconds(3), scheduler: MainScheduler.instance) Observable.merge([a,…
MrKew
  • 333
  • 1
  • 14
0
votes
0 answers

How to determine the type of error in RxSwift

How can I determine if the error in RxSwift is a 401. I use this func extension LoginInteractorApi { // MARK: - Internal func loginUser(input: LoginInputModel) -> Observable> { RxAlamofire .requestJSON( …
user1898829
  • 3,437
  • 6
  • 34
  • 62
0
votes
1 answer

What is the equivalent of RACChannel in RxSwift?

I want to make one-way binding from UIViewController to VewModel, in ReactiveObjC I've used RACChannel. What is the equivalent of a later one or what is the best way to do that?
DarkSatyr
  • 138
  • 4
0
votes
0 answers

Laying out UITableView contents

The title itself might a bit misleading and I believe the problem is best explained with an example. Take Facebook's feed, for instance. Every item consists of the following: Header (user's name, etc), static height Main content (text, attachment),…
0
votes
1 answer

How do I recover from a failed rx chain?

Rx seem a bit fragile in that it closes down an entire chain if one single thing doesn't work. That has become a real problem in my code as I have a chain that requests parameters through ble. First we ask for ids, then definitions which is sort of…
Joakim Sjöstedt
  • 824
  • 2
  • 9
  • 18
0
votes
0 answers

Collectionview inside collectionview cell causes flickering while scroll

I have collectionview with multiple section and vertical scrolling. Each have only one item. Screen flow is like below: I call an api which provides me feedId and url for to fetch section data. When user scrolls collectionview api gets called for…
0
votes
2 answers

Should I put my UserDefaults saving process into ViewModel? (good architecture)

I'm creating a simple NewsApp. I want to create the best app architecture I can made. So my question is that if I want save really simple data like username and maybe 5-6 tags as strings, should I put userDefaults logic into my viewModel or should I…
0
votes
0 answers

Swift 5: Change the input format of a texfield as currency

I would like to change the input format of my textfield. I want to give my textfield a currency format, like this: $5 $55 $556 $5.560 $55.560 $556.001 This is my code: func currencyToString() -> String? { let formatter = NumberFormatter() …
akitainu22
  • 95
  • 1
  • 8
0
votes
1 answer

Accessing a closure property of an instance in RxSwift

I am trying to deep dive into RxSwift and figure out different approaches. I realized some project in Github using similiar code structure as below. I used to think as imperative way but I really wonder what i am missing in Rxswift world. class…
DrainOpener
  • 186
  • 1
  • 18
0
votes
1 answer

Rxswift modelSelected

Data was imported and bound using api. And I want to apply it to the table view and take data to the detailed view using Rxswift when selecting the table view. But there's an error. What's wrong? enter image description here Fetch Service …
이진성
  • 1
  • 1
0
votes
2 answers

MVVM + RXSwift+ Coordinator how to set data?

Good night! Can you tell me how can I write data from controller 2 to controller 1? I have a coordinate at the main screen. final class MenuCoffeLikeCoordinator: TabBarPresentableCoordinator { var tabBarItem: UITabBarItem = { let title =…
0
votes
0 answers

Not Sure If I am using Rx Swift Correctly - BehaviorRelay Bind to TableView

I am trying to update tableview via a delete button on my table cell class. But it doesn't update the tableview instantly which I don't know if it's too much to ask from behavior relay. Properties: private let businesses:…
iPancake
  • 109
  • 1
  • 9
0
votes
1 answer

How to fix Cyclonemtic Complexity? - RxDataSource RxSwift - SwiftLint

I met warning like this "Cyclomatic Complexity Violation: Function should have complexity 10 or less: currently complexity equals 14 (cyclomatic_complexity)" when I used RxDataSource. My code structure like this: struct ItemDetailDataSource { …
hhg
  • 79
  • 1
  • 6
0
votes
1 answer

RxSwift - Determining whether an Observable has been disposed

I'm trying to get Publisher which vends Observables to its clients Consumer, to determine when one of its consumers has disposed of its Observable. Annoyingly. my code was working fine, until I removed an RxSwift .debug from within the Consumer…
Oliver Pearmain
  • 19,885
  • 13
  • 86
  • 90
1 2 3
99
100