unoplatform / uno.extensions

Libraries to ease common developer tasks associated with building multi-platform mobile, desktop and web applications using Uno Platform or WinAppSDK.
https://platform.uno/
Other
72 stars 46 forks source link

[MVUX] Reactive Generators should implement interfaces on Model #2174

Open dansiegel opened 7 months ago

dansiegel commented 7 months ago

What would you like to be added:

If my model has implemented an interface such as IDisposable the interface should be implemented on the generated Bindable Model.

public partial record MainModel : IDisposable
{
    void IDisposable.Dispose()
    {
        // dispose some resources
    }
}

public partial class BindableMainModel : IDisposable
{
    void IDisposable.Dispose()
    {
        ((IDisposable)Model).Dispose();
    }
}

Note that any interfaces would most likely need to be explicitly implemented as shown otherwise the Reactive Generator would currently assume that it is a Command that needs to be implemented. This should also support properties and events on interfaces not just methods.

Why is this needed:

This would allow the MVUX pattern to be used beyond just Uno.Extensions.Navigation as it would open it up to other frameworks where you might want or need to use interfaces for things such as Navigation.

nickrandolph commented 4 months ago

@dr1rrb did this get addressed?