adospace / reactorui-maui

MauiReactor is a MVU UI framework built on top of .NET MAUI
MIT License
588 stars 49 forks source link

Is it possible to use the HotReload Pipeline for conventional C# Markup based maui projects on Mac? #202

Closed appsure closed 8 months ago

appsure commented 8 months ago

Ciao Ado, really nice work here, bellissimo! Issue is I have an extensive project already built out utilizing C# Markup & moving solely to your project doesn't make sense yet. Love the HotReload...would it be possible to use it on Mac to reload/rerender conventional Maui ContentPages? How about running both side by side, lets say any new pages I add would be ReactorUI? Possible? Thanks, Serge.

adospace commented 8 months ago

Hi Serge, unfortunately, it is not possible to hot reload the conventional ContentPage: mainly because in a standard MVVM application UI (content page) is usually bound/linked to the State (ViewModel) while in an MVU app the UI part (the component) is weakly linked to the state (a POCO class) so when it's hot reloaded the component is updated with the new version and re-rendered while state is migrated from old version to new one.

Instead, you can "plugin" MauiReactor for new pages and, only for them, hot-reload will work on Mac (and on Windows). You need to get a look at the ComponentHost class provided by MauiReactor. It serves to "host" MauiReactor components in MAUI applications. You can also plug MauiReactor components in a Shell hosted application.

Please get a look at this documentation page: https://adospace.gitbook.io/mauireactor/components/xaml-integration

appsure commented 8 months ago

Thanks Ado, I'll try the ComponentHost approach. Am I paying a large price in performance doing this?

adospace commented 8 months ago

nothing that I can envision, just pay attention to not mixing MVVM and MVU, just keep things well structured and separated