You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have two methods, one for reading and one for writing (RxCompoundButton.checkedChanges and RxCompoundButton.setChecked, respectively). These are two halves of the same coin which could potentially be more easily represented in a property-like fashion of Subject<Boolean, Boolean>. This would allow a single point of observation and subscription.
Currently there are two overloads for all property reads: one which observes a zero or one allocation value (e.g., the Boolean checked-ness in this example) and one which wraps all emissions in an event object (e.g., CheckedChangedEvent in this example). This would mean that we'd actually need two overloads for the property, Subject<Boolean, Boolean> and Subject<CheckedChangedEvent, Boolean> which is slightly unfortunate (but certainly no more than it currently is).
The text was updated successfully, but these errors were encountered:
Would this mean that calling compoundButtonSubject.onNext(true) would cause the compound button to become checked?
If that's the case, then I am getting a nervous feeling about this because it's moving away from a functional approach and instead depends on side effects. With the two separated there is clearly a cause and an effect, with it combined then the effect could be a cause.
Maybe we'll just do this internally with a dedicated type.
I don't necessarily want a side-effect-having Subject but rather want a single type with which I can both observe values and update values. This is especially desired in situations where I want to have a single type that I can inject to hide the underlying mechanism (views aren't a good example in this case. think: preferences).
I'm envisioning a simple Property<T> extends Observable<T> implements Action1<T> or a Property<T> which is a factory for Observable<T>s and Action1<T>s.
Case study: The checked-ness of a
CompoundButton
.We currently have two methods, one for reading and one for writing (
RxCompoundButton.checkedChanges
andRxCompoundButton.setChecked
, respectively). These are two halves of the same coin which could potentially be more easily represented in a property-like fashion ofSubject<Boolean, Boolean>
. This would allow a single point of observation and subscription.Currently there are two overloads for all property reads: one which observes a zero or one allocation value (e.g., the
Boolean
checked-ness in this example) and one which wraps all emissions in an event object (e.g.,CheckedChangedEvent
in this example). This would mean that we'd actually need two overloads for the property,Subject<Boolean, Boolean>
andSubject<CheckedChangedEvent, Boolean>
which is slightly unfortunate (but certainly no more than it currently is).The text was updated successfully, but these errors were encountered: