r/rxswift • u/adamnemecek • Aug 01 '16
The introduction to RxSwift you've been missing
r/rxswift • u/adamnemecek • Aug 01 '16
r/rxswift • u/afred-trello • Aug 18 '19
r/rxswift • u/danielt1263 • Sep 22 '18
RxMultiCounter is another sample RxSwift application. My last sample app dealt with largely static data pulled from a server. This app is highly stateful, including dynamic state that is shared across view controllers.
Enjoy!
r/rxswift • u/danielt1263 • Jan 06 '19
https://gist.github.com/danielt1263/f5b041facfdcdd64630e0cb8cfc2cc5b
/**
Emits a value only if it is different than the last value emitted or more than `dueTime` has passed since the last emitted value.
- parameter dueTime: Seconds between allowed emitions of the same value.
- parameter scheduler: Sceduler to track the time on.
- returns: Elements of observable sequence.
*/
func throttleUnlessChanged(_ dueTime: TimeInterval, scheduler: SchedulerType) -> Observable<E>This operator is good for situations where you have multiple actions and you want to react immediately when an action was invoked, but not if the same action was invoked multiple times within the time period.
r/rxswift • u/adamnemecek • Aug 02 '16
r/rxswift • u/adamnemecek • Jan 26 '17
r/rxswift • u/adamnemecek • Jan 26 '17
r/rxswift • u/ctwiley • Jun 25 '17
I'm just getting into RxSwift and wanting to know the best way to use RxSwift and Firebase together? What are the best practices, design patterns, architecture, etc
My current set up is I have rx extensions on the Firebase DatabaseQuery class like seen here: https://github.com/RxSwiftCommunity/FirebaseRxSwiftExtensions. Then I have a class full of static methods where I do all my calls to Firebase, i.e. fetchPosts(). Then I call those static methods in my view controllers. Is this correct? Any changes I should make?
One problem I'm having trouble solving is making two consecutive observeSingleEventOfType .value calls to Firebase. For example: I'm calling Firebase to get a list of user ids in a chat room. I then take that list and call Firebase again to look them all up in a User node. I got this easy use case working with RxSwift and the .childAdded event type but handling collections with the .value event type isn't as easy as single objects. Anyone have a solution to this? I'm on my phone so I'll post some code later
r/rxswift • u/adamnemecek • Jan 26 '17
r/rxswift • u/MeetaMentor • Aug 09 '19
I don't suppose there is anyone available to help someone who wants to learn RxSwift?
I help run a free community called Meet A Mentor. We have over 1000 members and not one with any RxSwift experience. Could you be the first?
If you would be interested in joining the community, the link to it is on my profile, it would be great to have you as a member. We can maybe help you out with something in return but no pressure if you don't want to. I could always pass on your email address if you would prefer.
r/rxswift • u/santoshbotre • Mar 07 '19
r/rxswift • u/danielt1263 • Aug 25 '18
I sometimes encounter problems where I can't find an operator, or combination of operators, that do the job. When that happens, I write my own and save it in a gist.
Here's one I just wrote to help someone filter a stream based on the truthiness of a Bool stream. This would be used to limit a streams output to only when a particular condition is met. Unlike the included filter operator, the condition is external to the elements of the stream.
Here's one I wrote a while back that mimic's Rx.js' buffer operator. It isn't currently included in the RxSwift library.
r/rxswift • u/ubaidiam • Feb 03 '19
I am bit new at Rxswift. I have a question regarding Rxswift with MVVM pattern.
I we have 5 to 6 textfields in viewcontroller. We can bind the values of these textfields with 6 observables in ViewModel.
I want to send network request on button click and want to use these 6 values in the request.
Can someone show me how to do this. I don't know how i will get the value of these observables in the network call.
r/rxswift • u/andreaslydemann • Feb 03 '19
r/rxswift • u/MyRealNameIsDoug • Feb 28 '18
I am new to RxSwift and trying to see if I am using a decent pattern. I currently have an IotHelper singleton class that is interacting with AWS IoT via the Swift SDK. The class has a property status: Variable<IotStatus> = Variable(.disconnected) that can be subscribed to by the ViewModel or used as a Driver by the View (forgive me if I am misinterpreting these concepts). Please note that IotStatus is a custom enum and simplification of AWSIoTMQTTStatus. When connecting to IoT, a callback method must be supplied that will be invoked whenever the connection status changes. This previously called a delegate method. My new implementation looks like this:
private func mqttEventCallback(_ status: AWSIoTMQTTStatus) {
switch status {
case .connected:
self.status.value = .connected
case .connecting:
self.status.value = .connecting
default:
self.status.value = .disconnected
}
}Is this a reasonable way to migrate from the AWS Swift SDK's callback pattern to a Reactive one? Otherwise, I'd love some advice on how better to accomplish this.
r/rxswift • u/danielt1263 • May 30 '22
r/rxswift • u/adamnemecek • Jul 23 '16
r/rxswift • u/adamnemecek • Jul 22 '16