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
Use new Single
unit from RxSwift 3.3
#77
Comments
Sounds like a good idea. Only situation to consider is if you'd want to have a replay behaviour but in that case you can always do Another issues with this is it would probably have to be an additional/alternative implementation and not a substitution to avoid breaking changes to people using the Observable variant. |
What do you think about this strategy?
|
My thought was the first 2, but is there a good reason to remove Observable(s) at all? If someone wants them he can just use them. |
Also don't forget that not all HTTP requests have single response. there is also |
My thought was that if it's already easy enough to call
👍 Good note, I'll keep that in mind if I end up trying to work on this. |
If you don't end up working on this LMK, I wouldn't mind handling as well :) @joshfriend Good luck! |
I came to an unfortunate realization last night. Swift allows overloading methods that differ only in return type: func data() -> Observable<Data>
func data() -> Single<Data> However, when you try to use one of those functions, you get a compile error "Type of expression is ambiguous without more context" or something similar. You need to cast or hint the type of the desired return value somehow: let request = data() as Single<Data>
// or
let request: Single<Data> = data() Thus, adding a parallel APIs returning Possible workaround would be to name the functions differently for the // Current API:
func data() -> Observable<Data>
// New APIs:
func getData() -> Single<Data>
// or
func dataSingle() -> Single<Data> I don't really like those names though, the existing API names are quite good. |
@joshfriend Yeah I kinda had that thought yesterday as well. This is kind of a problem, I don't have a good thought about it yet but I have a couple of questions we need to answer :
All good answers we should answer before we proceed here I imagine. Would love everyone's thoughts :) |
Hi guys, I think the simplest solution would be to create a new major version of RxAlamofire that uses |
Marking this as enhancement for now but I still think like this would need some more thought to make sure API still feels consistent and doesn't break too many things :) |
RxSwift 3.3 added a new
Single
trait (formerly called "unit"):Docs
As mentioned in RxSwift docs, HTTP requests fit this model extremely well.
The text was updated successfully, but these errors were encountered: