As one of the authors of ReactiveUI, I have found that Xamarin.Forms does not provide the requisite view life cycle hooks to enable the framework to manage the activation and deactivation of resources in response to the comings and goings of views.
Specifically, I have found these problems:
Page.Appearingactually fires in response to
ViewDidAppearon iOS. One of ReactiveUI's benefits is its code-based, type-safe binding infrastructure.
Appearingis the only hook we can use to get stuff on the screen, but it fires too late on iOS, so there is a brief period where the screen is not populated with data. I have already attempted to start a discussion here, but it seemed to stagnate.
View, there is no way to tell when that
Viewappears and disappears from the screen. There is no
View.Disappearingevents as there is for
Page. It might seem appropriate to therefore search up the visual tree for the
Pageand hook into that. However, this is inefficient (but perhaps that's inevitable) and there is no means of knowing when the
Pageitself changes. There is no
PropertyChangeddoes not fire in response to the
Page.Appearingshould fire in response to
ViewWillAppearon iOS. Moreover, there should be
Page.Disappearedcounterparts. Yes, this is potentially breaking to people who are hooked into
Appearingand rely on it firing in response to
ViewDidAppearon iOS. However, that behavior has always been incorrect and the fix for these people is literally to change
Appeared(or hold off on the XF upgrade).
Viewand have them Just Work. Failing that, ensure there is a hook by which framework authors can know the hosting
Viewhas changed. Perhaps a specific
PageChangedevent, or just ensuring
PropertyChangedworks as expected in this scenario.
The use case here is to give framework authors what they need to facilitate the creation of self-sufficient, standalone, encapsulated components by framework consumers. I specifically work on ReactiveUI, but other framework authors will/have run into the same issues.
ModEdit - Spec incoming ASAP