Skip to content
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

isVisible does not always work if not subscribed immediately #13

Open
PhilippeCuvillier opened this issue Nov 13, 2018 · 0 comments
Open

Comments

@PhilippeCuvillier
Copy link

Hello,

thank you very much for this great Pod. I think there might be an issue with UIViewController isVisible property.
For instance, if this Observable is not subscribed to before the base method viewWillAppear() is invoked for the first, time, then isVisible will emit nothing instead of emitting true.

My point is that isVisible should behave like a state, not just like a combination of events: any time some observer subscribes to it, it should immediately get an event true or false.
To do so, there would be two things to do:

  • using a .share(replay: 1, scope: .forever) and a .startWith(false).
  • subscribing it internally, so that is begins immediately to listen for the viewDidAppearObservable and viewWillDisappearObservable, even if externally there are no subscribers to it. Maybe using a .publish() and .connect(), or using an internal DisposeBag property.

Thank you very much, I would be pleased to know your opinion on this.

P.S. : And to go a bit further, it might be interesting to expose it as a Driver instead of an Observable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant