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
In the displayed variable created in Reactive+UIViewController.swift the initialState variable is set to false.
/// Rx observable, triggered when the view appearance state changes
vardisplayed:Observable<Bool>{letviewDidAppearObservable=self.sentMessage(#selector(Base.viewDidAppear)).map{ _ intrue}letviewDidDisappearObservable=self.sentMessage(#selector(Base.viewDidDisappear)).map{ _ infalse}
// a UIViewController is at first not displayed
letinitialState=Observable.just(false)
// future calls to viewDidAppear and viewDidDisappear will change the displayable state
return initialState.concat(Observable<Bool>.merge(viewDidAppearObservable, viewDidDisappearObservable))}
Because of this initial state, if subscription to this observable occurs after a view is on screen the initial value will be false and will not change. This is a potential problem when contributing Stepper whose Presentable is a UIViewController.
One potential solution would be to change the initialState like so:
// a UIViewController is at first displayed if it's view has a window
// https://stackoverflow.com/a/2777460
letinitialState=Observable.just(base.viewIfLoaded?.window !=nil)
I'm happy to PR this change if others think it would be useful.
The text was updated successfully, but these errors were encountered:
In the displayed variable created in
Reactive+UIViewController.swift
theinitialState
variable is set to false.Because of this initial state, if subscription to this observable occurs after a view is on screen the initial value will be
false
and will not change. This is a potential problem when contributingStepper
whosePresentable
is aUIViewController
.One potential solution would be to change the
initialState
like so:I'm happy to PR this change if others think it would be useful.
The text was updated successfully, but these errors were encountered: