What is .NET MAUI?
.NET MAUI (Multi-platform App UI) is a cross-platform UI framework for building native apps using .NET and C#. It is the evolution of Xamarin.Forms, a popular UI toolkit for building mobile apps that run on multiple platforms. With .NET MAUI, developers can create a single codebase that targets multiple platforms, including iOS, Android, macOS, Windows, and Linux.
Who .NET MAUI is for
.NET MAUI supports a variety of platforms, including Windows, macOS, iOS, Android, and Linux, and provides a set of common UI controls and layouts that can be used across all platforms. This allows developers to write their application logic once and have it run on multiple devices and operating systems. .NET MAUI is for developers who want to:
- Write cross-platform apps in XAML and C#, from a single shared code-base in Visual Studio.
- Share UI layout and design across platforms.
- Share code, tests, and business logic across platforms.
[source: Microsoft]
Some of the key features of .NET MAUI include:
- A modern and flexible UI architecture based on the Model-View-ViewModel (MVVM) pattern.
- A rich set of controls and layouts that can be customized to fit the needs of any application.
- Support for native platform-specific APIs and capabilities, allowing developers to take advantage of features unique to each platform.
- Built-in support for hot reload, which allows developers to see changes to their application code in real-time without having to recompile or redeploy the app.
How .NET MAUI works
.NET MAUI unifies Android, iOS, macOS, and Windows APIs into a single API. It allows a write-once run-anywhere developer experience and additionally provids deep access to every aspect of each native platform.
.NET MAUI provides a single framework for building the UIs for mobile and desktop apps. The following diagram shows a high-level view of the architecture of a .NET MAUI app:
[source: Microsoft]
.NET MAUI apps can be written on PC or Mac, and compile into native app packages:
- Android apps built using .NET MAUI compile from C# into intermediate language (IL) which is then just-in-time (JIT) compiled to a native assembly when the app launches.
- iOS apps built using .NET MAUI are fully ahead-of-time (AOT) compiled from C# into native ARM assembly code.
- macOS apps built using .NET MAUI use Mac Catalyst, a solution from Apple that brings your iOS app built with UIKit to the desktop, and augments it with additional AppKit and platform APIs as required.
- Windows apps built using .NET MAUI use Windows UI 3 (WinUI 3) library to create native apps that target the Windows desktop.
Overall, .NET MAUI is a powerful and flexible framework that makes it easier for developers to create high-quality, cross-platform applications using .NET.