adospace / reactorui-maui

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

MauiReactor

Component-based UI Library built on top of .NET MAUI

Build status Nuget

MauiReactor is .NET library written on top of .NET MAUI that allows you to write applications in pure C# using an MVU approach.

This is the classic Counter app in MauiReactor:

class CounterPageState
{
    public int Counter { get; set; }
}

class CounterPage : Component<CounterPageState>
{
    public override VisualNode Render()
        => ContentPage("Counter Sample",
            VStack(
                Label($"Counter: {State.Counter}"),

                Button("Click To Increment", () =>
                    SetState(s => s.Counter++))
            )
            .Spacing(10)
            .Center()
        );

}

Setting up MauiReactor from CLI

  1. Install MauiReactor templates

    dotnet new install Reactor.Maui.TemplatePack
  2. Install MauiReactor hot reload console command

    dotnet tool install -g Reactor.Maui.HotReload

    If you already installed an old version of Reactor.Maui.HotReload you can update it to the latest using this command:

    dotnet tool update -g Reactor.Maui.HotReload
  3. Create a sample project

    dotnet new maui-reactor-startup -o my-new-project

    and move inside the new project folder

    cd .\my-new-project\
  4. Build & run the project (emulator or device must be running and configured)

    dotnet build -t:Run -f net8.0-android

    Under Mac, to target an iOS device/emulator, issue a command like this:

    dotnet build -t:Run /p:_DeviceName=:v2:udid=<device_id> -f net8.0-ios

    where the device id comes from this list:

    xcrun simctl list
  5. Hot-reload console (in a different shell)

    dotnet-maui-reactor -f [net8.0-android|net8.0-ios|...]
  6. Edits to code should be hot-reloaded by the application --> Enjoy!

Documentation

Documentation

Videos

All Packages

Introductionary video from Solution1 conference YouTube Video Views

Interview with James Montemagno YouTube Video Views

Getting started video from Gerald Versluis YouTube Video Views

Sample Applications

Main Samples Repository

Rive App

KeeMind App

Samples and test application

How to contribute