iTranslated by AI
What is .NET MAUI?
At the recent Build event, Microsoft suddenly announced the release of ".NET Multi-platform App UI (MAUI)."
In this post, I would like to briefly summarize what MAUI is and what will happen to Xamarin.Forms.
As of May 23, 2020, the most reliable sources of information regarding MAUI are likely the following two. Probably.
- Introducing .NET Multi-platform App UI | .NET Blog
- GitHub - dotnet/maui: .NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
In short, MAUI is:
- A cross-platform UI framework using .NET
- Supporting both mobile and desktop
- An evolution of Xamarin.Forms
- Scheduled for release in November 2021, aligning with .NET 6
- With a preview version expected later this year
Now, let's go over a few key points.
What are the benefits of MAUI?
Compared primarily to Xamarin.Forms, it has the following advantages:
- It runs on .NET 6, which unifies .NET Core and Mono.
- It enables cross-platform development with a single project and a single codebase (including resources like images).
- It supports MVU for building UIs in C#, in addition to MVVM with XAML, as well as Blazor support.
There was also mention that it supports multi-window, making it ideal for implementations like those for the Surface Duo, but we'll see how that turns out.
It also seems to improve performance and make extending controls simpler.
Regarding Blazor, there is actually so little information that it is completely unclear how it will be supported.
What is this support for MVU for building UI with C#?
This involves two aspects.
One is the provision of a mechanism for implementing UI using the C# language, rather than a markup language like XAML.
The other is the support for the Model-View-Update (MVU) pattern when implementing UI in C#.
Let's take a look at an actual sample code. This was published on this blog.
readonly State<int> count = 0;
[Body]
View body() => new StackLayout
{
new Label("Welcome to .NET MAUI!"),
new Button(
() => $"You clicked {count} times.",
() => count.Value ++)
)
};
It means that a way to implement UI in code, like Flutter, will be officially supported, and since the MVU pattern is recommended in that case, the implementation of a framework for it will be provided.
Originally, XAML itself had a relatively high learning curve, and some people were already implementing UI in C# instead of XAML, so being able to implement it entirely in C# will be a benefit in itself. There was also an explanation that it works well with hot reload.
Personally, I have a slight concern about how this will be handled, as it might become more difficult to provide designers, which could slightly raise the barrier to entry. If I were using it alone, it would be fine, but... Could this lead to the return of designer.cs? Probably not...
Is XAML going away?
It is not going away. They will coexist. Basically, it seems you will choose between the following two:
- UI implementation using XAML with the MVVM pattern
- UI implementation using C# with the MVU pattern
Is Xamarin.Forms going away?
As a brand, yes. However, in reality, it is likely a rebranding; it will continue to be provided under the name Xamarin.Forms until .NET 6 is released, but it will be rebranded to MAUI with the release of .NET 6, and thereafter it will head towards retirement.
There is an intention to support migration, and migration tools are expected to be provided as well.
A few things I'm curious about
Correction on 2020.09.26
There is a comparison table between Xamarin.Forms and .NET MAUI on GitHub, but there are a few points of concern.
The development of macOS (which is currently Xamarin.Mac) and WPF has changed from "Community" to "Microsoft".
I wonder if they aren't getting enough cooperation from the community? I don't think they would revert the code to be closed-source, though...
According to a former Xamarin team member, the macOS side was originally developed in-house at Microsoft, so it's likely a typo in the table, and for WPF, it's because the community developer joined Microsoft, so there doesn't seem to be any major cause for concern.
@atsushieno, thank you for the information!
The development of macOS (which is currently Xamarin.Mac) and WPF has changed from "Community" to "Microsoft". I wonder if they aren't getting enough cooperation from the community? Mac has been developed by MS employees from the start, so this is likely a misunderstanding in the table. As for WPF, I think it's because a community developer joined as an employee. https://t.co/G29acbnjMh
— Atsushi Eno (@atsushieno) September 25, 2020
That's all. See you next time.
Discussion