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

issue with having rx.tap for UIButton in UICollectionViewCell - RxSwift 3

I am subscribing 2 times for 1 UIButton : First subscription, for updating UI on every click Second subscription, for updating the values on Web Service every 1 second after accumulated clicks. Code: class ProductionSize { var id : Int? …
MBH
  • 16,271
  • 19
  • 99
  • 149
9
votes
4 answers

How to realize UIPickerView with RXSwift

just like UITableView items.bindTo(tableView.rx.items(cellIdentifier: "cellIdentifier", cellType: AttentionTableViewCell.self)){(row,dic,cell) in cell.configueCell(with: dic) }.addDisposableTo(dispose)
BaQiWL
  • 417
  • 5
  • 14
9
votes
1 answer

How to bind table view with multiple sections that represent different data types using RxSwift and RxSwiftDataSources?

I am trying to create a table view with multiple sections using RxSwift. Each section displays data representing a different type. I found the RxSwiftDataSources library and implemented the example from their documentation. Here is a quick…
nburk
  • 22,409
  • 18
  • 87
  • 132
9
votes
5 answers

How do I initialize an observable property in RxSwift?

I find this very puzzling. Coming from ReactiveCocoa I would expect something like this possible. How can I initialize the RxSwift observable to 5?
Earl Grey
  • 7,426
  • 6
  • 39
  • 59
9
votes
1 answer

RxSwift: Append elements to Observable<[_]>

I have an array (Observable<[_]>) that is a datasource for a tableview. I want to be able to append new elements to it and update the tableview every time new elements are appended to the array. I can't find how to add new elements to…
alexxjk
  • 1,681
  • 5
  • 18
  • 30
9
votes
4 answers

Rxswift - how to show a progress bar

I need to show a progress bar upon an API call and hide it after the API call completes. The following is code I have written to populate a table. Where should I make calls to show and hide progress for the API being called? Is there an RxSwift way…
9
votes
1 answer

RxSwift repeated action

I'm switching from RAC and want to have a repeated network request, returning different result types depending on the API of the request. I want to use an interval, but I don't know how to match the return types. var loop: Observable { …
beseder
  • 1,352
  • 2
  • 15
  • 25
9
votes
2 answers

Combining Alamofire and RxSwift

I have this custom implementation of Alamofire: protocol HTTPProtocol: class { typealias RequestType typealias RespondType func doRequest(requestData: RequestType) -> Self func completionHandler(block:(Result)…
Pham Hoan
  • 2,107
  • 2
  • 20
  • 34
8
votes
1 answer

How do I make a resettable RxSwift Timer?

I'm trying to build a countdown timer app. Naturally, I need an Observable sequence that gives me an element each second. The twist is that I need this sequence to respond to changes to two other sequences: Paused: Observable. This…
Sweeper
  • 213,210
  • 22
  • 193
  • 313
8
votes
2 answers

Best practice for binding controls in UITableViewCell to ViewModel using RxSwift

I'm in the process of migrating an existing app using MVC that makes heavy use of the delegation pattern to MVVM using RxSwift and RxCocoa for data binding. In general each View Controller owns an instance of a dedicated View Model object. Let's…
Dragonspell
  • 327
  • 4
  • 13
8
votes
3 answers

How to obtain a UIAlertController observable (ReactiveCocoa or RxSwift)?

I implemented a "reactive" UIAlertController so I can get an Observable of the button press. (See code below). My question, or questions, are: Is this implementation correct? I don't like storing the observers; I wonder if there's a better…
Ferran Maylinch
  • 10,919
  • 16
  • 85
  • 100
8
votes
5 answers

RxSwift How to subscribe a observable only one time?

I want to subscribe to an observable, but in some logic, I will re-subscribe to it. If I don't want to write some special logic for it, how can I dispose the last subscription when I add a new one? Or, when I subscribe to it, how can I know if this…
Bruno
  • 81
  • 1
  • 1
  • 2
8
votes
1 answer

Changing one property in a variable triggers subcriptions to other properties. RxSwift

I have the following struct of properties for Chat struct Chat { var id = String() var gender = String() var date = Date() init() {} } In a view controller, i declare an instance of Chat called observablechat, and then i used the…
Ryan
  • 969
  • 1
  • 6
  • 19
8
votes
2 answers

TabelView Delegate methods using RxSwift

I am using RxSwift for TableView.I need to calculate height of dynamic cells previously I did it in WillDisplayCell delegate method. I don't know how to bind TableView Delegate methods with RxSwift. Can any one help?
Mehreen
  • 501
  • 3
  • 6
  • 11
8
votes
3 answers

Reload Tableview using RxSwift

I am using RxSwift for tableview. I need to reload my table each time after getting data from api but I'm failed to do this. I couldn't find any solution for that. Can anybody help? I have an array of places obtain from response of an Api.I have…
Mehreen
  • 501
  • 3
  • 6
  • 11