dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

Update PageViewController with events we can hook into for lifecycle methods like ViewDidAppear #10126

Open JohnHDev opened 2 years ago

JohnHDev commented 2 years ago

Description

The new handler style doesn't hook in well in PageHandler for UIViewController lifecycle events. In XF we override ViewWillAppear but we can't do that with handlers (as far as I can see).

Since PageHandler uses a PageViewController MS can update that with lifecycle events so we can wire up cleanly.

https://github.com/dotnet/maui/blob/bd64a7ab2f1c0992d667d93576d16bc565d0e041/src/Core/src/Platform/iOS/PageViewController.cs

Public API Changes

Add ViewWillAppear and other lifecycle events to PageViewController.

Intended Use-Case

Much easier customisation on iOS, think adding buttons on the left instead of the right. Can't do this easily with the current Handler implementation.

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

PureWeen commented 2 years ago

@JohnHDev Yea :-/ we really need to provide a virtual method for the ViewController

Not a great solution but can you just copy and paste that whole https://github.com/dotnet/maui/blob/main/src/Core/src/Handlers/Page/PageHandler.iOS.cs#L10-L25 into your handler?

JohnHDev commented 2 years ago

@PureWeen Thanks, yes that should work, I'll take another look at this shortly.