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
1
vote
2 answers

RXSwift flatMap two methods

I'm having 2 methods like this: func rxGetAllTonicsForLanguage(language: Language) -> Observable func saveTonics(list: [Tonic]) -> Observable Now I want to first do the getAllTonics call and then with the result of that call…
user1007522
  • 7,858
  • 17
  • 69
  • 113
1
vote
1 answer

RxSwift: Nested Queries and ReplaySubject

I have to fetch three types of data (AType, BType, CType) using three separate API requests. The objects returned by the APIs are related by one-to-many: 1 AType object is parent of N BType objects 1 BType object is parent of P CType objects) I'm…
dlmt
  • 166
  • 1
  • 11
1
vote
1 answer

RxSwift How to add "clear all" UIButton to simple spreadsheet example

Here's the code from the RxSwift repo for a simple spreadsheet (adding three numbers): Observable.combineLatest(number1.rx_text, number2.rx_text, number3.rx_text) { textValue1, textValue2, textValue3 -> Int in return (Int(textValue1) ?? 0) +…
1
vote
2 answers

Write Unit Tests for RxSwift

I got this class which I'd like to write tests for: import CoreLocation import RxCocoa import RxSwift struct LocationManager { private (set) var authorized: Driver private let coreLocationManager = CLLocationManager() init() { …
dehlen
  • 7,325
  • 4
  • 43
  • 71
1
vote
1 answer

Why nsurlsession.datataskwithrequst was canceled

I am using nsurlsession on RxSwift. I am facing two problems about nsurlsession on RxSwift. I created Custom Observable. This Observable has used nsurlsession. nsurlsession.datataskwithrequst was canceled everytime on RxSwift. My code is here func…
1
vote
1 answer

observing and assigning properties

In an ObjC project I am using this ReactiveCocoa pattern RAC(self.pagingControl, currentPage) = RACObserve(self.pagingView, index); What's the Swift equivalent with RAC4 and RxSwift? I am a bit lost in the docs on that.
tcurdt
  • 14,518
  • 10
  • 57
  • 72
1
vote
0 answers

Custom UISlider with RxSwift support

I have created a custom control thad works as UISlider. Now I want to use it with RxSwift and for this I need rx_value like property for my control. I have found RxSwift code for UISlider on GitHub: extension UISlider { /** Reactive…
alexxjk
  • 1,681
  • 5
  • 18
  • 30
1
vote
1 answer

RxSwift: Receive events immediately, unless the last event was processed within a certain interval

New to RxSwift / Reactivex. Basically what I'm trying to do is to make a server call whenever something happens, but make sure it's not done more often than every 10 seconds. Less often if possible. For instance, whenever an event ("needs update")…
Andreas
  • 2,665
  • 2
  • 29
  • 38
1
vote
1 answer

RxSwift: Observe rx_text & rx_offset simultaneously

I've been working on a search controller that is using RxSwift to update DataSource when user types in Search field, like it's described here: http://www.thedroidsonroids.com/blog/ios/rxswift-examples-3-networking/ That is my viewmodel: struct…
alexxjk
  • 1,681
  • 5
  • 18
  • 30
1
vote
2 answers

RXSwift - How to recall an api

i created an observable for an api call and bind to a tableview. Now i am unclear how to call the same api once again? so as to do a refresh - say on an button click?. The following is my sample code. Please let me know your thoughts it will be…
1
vote
2 answers

RxSwift and CLLocation : crash when trying to get user location

I am using RSwift library in my app. I am trying to get the user location in order to send it in a network request. To get this location, I need to use Observables because the function must throw an error in case of user did not authorize…
romroll
  • 11
  • 2
1
vote
1 answer

Can I add observer to "zoom" property of GMSMapView()?

I want to add an observer on zoom (Float) property of GMSMapView. I wonder if it is possible and how can I do it?
Marina
  • 1,177
  • 4
  • 14
  • 27
1
vote
0 answers

Creating a user-controllable RxSwift Observer

I'm trying to implement user-driven refreshing in my Rx based networking code, and my current design is as follows: Create a sink that has Void values passed into it every time the user initiates a refresh action flatMap the latest .Next event on…
rpowell
  • 1,464
  • 2
  • 16
  • 29
1
vote
1 answer

Mapping JSON response to objects using Rx programming (Moya)

I am currently trying to learn Rx programming. I found Moya intriguing and have been trying to implement a simple network request which then gets mapped to objects which I can then use to populate a tableView. I have been following this tutorial:…
pls
  • 1,522
  • 2
  • 21
  • 41
1
vote
1 answer

Rx_Swift for Local and Push Notifications

How can I implement observable for Local notification and Push notifications when they are received. In app delegate, We are notify on didReceiveLocalNotification and didReceiveRemoteNotification How can I listen these notification on other…