-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the difference between PromiseKit and RxSwift? #484
Comments
I've not looked into ReactiveX/RxSwift, but our brief on Reactive Cocoa is probably relevant (from our docs):
|
In RxSwift terms, Promises are a reactive pattern for asynchronicity. PromiseKit take the good parts of reactive programming and apply them to the hardest part of pure Swift development. RxSwift requires you to commit fully to a paradigm shift in how you program. If you do it right your code will be more robust, but you may have trouble finding other developers experienced with reactive paradigms to work on the project. Promises make code that is pretty clear to most developers. |
@rlam3 at a higher level too, Promises (and PromiseKit) are just a tool you can use to write code that needs to go off and do some stuff and return at some unknown time. Where a simple line So with Promises, you can write code that "waits" for things to happen and yet is easy to read. It's possible to do everything you can do with Promises without using Promises, but you'll end up writing a lot of code to do very basic things that have nothing to do with what your app is actually trying to accomplish. RxSwift is a much bigger idea and promotes a different way of writing apps in general. PromiseKit is great to include in any project that does asynchronous stuff (stuff that does not execute immediately), regardless of whether or not you are using RxSwift. |
Closing due to stagnation. |
This might seem like a silly thing, so I definitely want the critique if it is. Seems to me that mixing the 2 provides some benefit. I know from looking at my Rx code there tends to be a lot of chaining for different streams. Sometimes though it's nice to only surface up the:
I know you can do the something similar with Rx and mixing things is including 2 libs that overlap in functionality. But if done in a disciplined way I think there are some benefits when viewing the code: Rx
Promise
I think the Obviously one of the downfalls of this is that you would get people mixing paradigms throughout a code base, which would definitely be bad. Again though, with a little discipline I think it's a problem that can be worked around. For things like input validation etc, Rx will really shine by being exposed at the call site and provide the reader a nice way to capture what's happing to the data. On simple async calls though, I think the Promise provides a cleaner call site implementation. Of course I could just be holding it upside down and not even know it. I'm not SUPER 100% expert at the Rx paradigm |
What is the difference between PromiseKit and RxSwift?
The text was updated successfully, but these errors were encountered: