-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Moving *Relay into their own Framework. #1501
Comments
Hi @sandeeplearner ,
Yes, so far we haven't put deprecation warnings on it since that API was pretty heavily used and I wanted to ease the 4.0 migration path. We are currently preparing it for deprecation, but if somebody sees it there they will be incline not to use it. Another reason why we haven't add deprecation warnings is because a clear deprecation path isn't decided yet, the only thing that is decided is that that concept will be deprecated in RxSwift target because:
On the other side:
The current plan is this:
So far we are at: I'll probably add this issue to |
@kzaher : Thanks a lot 👍 |
@kzaher one pain point migrating var mutableCopy = relay.value
mutableCopy.mutateSomehow()
relay.accept(mutableCopy) |
this is a dangerous patten because after you read I am assuming people were doing this a lot, and because of Swift accessor semantics these issues where hidden, but I would say this is an anti-pattern for the mentioned reasons. That's why we haven't made For example, if you assume all code is executed on main thread, then this can't happen
But there is nothing in the API that prevents it. We'll probably at least move |
@kzaher even if it's a dangerous pattern in a multi-thread context, how would I append a new item to the value if for instance it was |
@kzaher and @DevAndArtist : I had exact same issue which I had posted in SO. https://stackoverflow.com/questions/47452582/how-to-use-behaviorrelay-as-an-alternate-to-variable-in-rxswift One solution proposed by community was to use
Though it works, I dont think this is the best way to use it. I am sure many are facing this confusion. Please add a sample usage of |
With this change, does BehaviorRelay have to be in RxCocoa? When using this in layers beyond the view (e.g., Presenter/MVVM/Model layers), the best practice is to not include UI imports, but RxCocoa has a lot of UI aspects. Variable was a simple to use piece, that only required RxSwift, but BehaviorRelay breaks that paradigm in it's current library. |
@Herbal7ea The problem is Variable in itself isn't part of RxSwift or ReactiveX. It is a Cocoa-specific implementation that mainly works as an Imperative Bridge to people that find it hard to go "All declarative / all observable" immediately. It is not really a pure component of RxSwift to begin with 🤔 |
If we extract The earliest time we can do this is the next major release because of backwards compatibility. |
@freak4pc That makes sense. I am mostly concerned about where things are located (RxCocoa), and not the why. @kzaher yeah, that would work. My hopes are mostly to separate the Variable alternative (BehaviorRelay) from any UI grouping. RxCocoa seems to be mostly geared toward working with UI pieces. Thank you both @freak4pc & @kzaher. |
Hi all, please help me the right way to append |
Hi @kzaher, |
@mortenbekditlevsen It will be done in 5.0 which will target Swift 5.0, so it's tied with Swift 5.0 release date. |
@kzaher That's perfect! :-) Thanks for the update! |
Is the plan still to separate SharedSequence and Relays into two separate frameworks? I still think its a bit too much noise (personal opinion) but am open to whatever people think :) |
good |
Done in #1924. |
No deprecation warning in Xcode on using Variable:
As per release notes provided here,
Variable
is deprecated in the favor ofBehaviorRelay
. But I dont see any deprecation warning on using Variable in XcodeExpected outcome:
Xcode should alert the deprecation of Variable.
What actually happens:
I am using
RxSwift4
. My pod specs looks likeMy project is making use of
Swift4
. When I declare a variablevar emyFilter = Variable<[MyFilterModel]>([MyFilterModel(data: "{:}")])
No warning is shown, realized the deprecation of
Variable
only when somebody specified it in their answer on SOJust realized that I cant even access
BehaviorRelay
with RxSwift (4.0.0) in pod repo. Am I missing anything here? IsBehaviorRelay
available in RxSwift4.0 and what should be our course of action? Should we still stick withVariable
orBehaviorRelay
? There are loads of content on web regardingVariable
but dont see much onBehaviorRelay
yet, so little confused of its usage as well. As I cant access it in my Xcode, cant even access the source codeRxSwift/RxCocoa/RxBlocking/RxTest version/commit
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
Installation method:
I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)
Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)
The text was updated successfully, but these errors were encountered: