What is .NET MAUI, and How Does it Differ from Xamarin?

Blog Detail Banner

What is .NET MAUI, and How Does it Differ from Xamarin?

What Gives .NET MAUI an Edge Over Xamarin

.NET MAUI (Multi-Platform App UI) is a cross-platform framework for developing native mobile and desktop apps with C# and XAML. With UI controls built from the ground up for extensibility and performance, using .NET MAUI, one can create multi-apps using a single codebase. It further helps improve performance and enrich each platform-specific feature by adding native aspects. MAUI allows applications to run code native to the devices using the UI toolkits provided by the manufacturers, creating a fully native experience without dealing with different frameworks, programming languages, and compilation processes. The primary aim is to enable developers to implement as much of the app logic and UI layout as possible in a single codebase. So, one can develop apps that run on iOS, Android, macOS, and Windows with a single shared codebase. However, you can add platform-specific source code and resources if required.

A new release from Microsoft based on Xamarin Forms, MAUI isn’t simply a repackaged Xamarin Forms.

.NET MAUI Vs. Xamarin

.NET MAUI is an evolution of the Xamarin Forms, and if one has used the latter to build cross-platform user interfaces, one would have noticed many similarities with .NET MAUI. However, there are many differences as well. The shift to Microsoft MAUI from Xamarin allows developers to create code without emphasizing much on the device, allowing them to focus on performance, design consistency, and desktop app features.

Following are a few differences between the two:

1. Project Structure

.NET MAUI uses a single project structure instead of juggling multiple projects simultaneously. The developers work on a single codebase that can be assigned to various operating systems to fine-tune the platform-specific features and capabilities. This allows them to focus on writing, debugging, and improving the code without worrying about device-specific aspects. On the other hand, Xamarin uses separate projects for each platform, making it more time-consuming and arduous.

2. Supported Platforms and Versions

One of the critical differences between MAUI and Xamarin is in their support for Windows. Xamarin supports UWP, whereas MAUI supports Win UI. Broadly the classification is as follows:

Xamarin Primarily Supports:

  • Android 4.4 (API 19) or higher
  • iOS 9 or higher
  • UWP: Windows 10
  • Additionally supports platforms: Samsung Tizen, macOS 10.13 or higher, GTK#, and WPF

.NET MAUI primarily supports:

  • Android 5.0 (API 21) or higher
  • iOS 10 or higher
  • MacOS 10.13 or higher
  • WinUI: Windows 10 version 1809 and Windows 11
  • Additionally supports platforms: Tizen, supported by Samsung, and Linux, supported by the community

3. Renderer and Handler Architectures

.NET MAUI uses handler architecture coupled with a native assembly resulting in a lightweight, high-performance app. In Xamarin, controls are made with renderers. This requires the developers to use a custom renderer if they want to customize a native controls’ UI, which takes up the costs heavily for performance and app size.

4. Additional Application Pattern

Xamarin Forms use Model-View-View-Model (MVVM) pattern. In addition to this, .NET MAUI is extended with the Model-View-Update (MVU) pattern. Having both patterns at their disposal allows the developers to deliver the best product more effectively.

5. Hot Reload Support

Hot reload is a popular feature that simplifies and streamlines the coding process and shortens the stages of the mobile app development cycle. In .NET MAUI, complete support for .NET hot reloads for C# and XAML is available. Xamarin does not support .NET hot reloads for C# (UWP has limited support for runtime edits using .NET’s edits and continue feature), and XAML hot load is still in the experimental stage.

6. Graphic APIs

Xamarin does not offer direct API to fulfill drawing or painting requirements. One has to do it on the native side using renderers. MAUI extends its capabilities and comes with graphics functionality that lets designers use the elements on the in-built canvas to create unique and original designs.

7. Blazor Apps

Blazor, one of the most popular programming models for web apps, can be utilized using the MAUI framework to develop interactive native desktop apps in C# and HTML. As opposed to this, developing Blazor hybrid apps is not possible in Xamarin.

8. Resource Maintenance

.NET MAUI has evolved from Xamarin regarding resources, specifically for images. Unlike Xamarin, it has done away with the need to maintain a set of images for the platform or device-specific needs. A single SVG image is enough to meet all platform and device requirements, which is converted into a .png image format to work across platforms.

9. Multiple Windows

In .NET MAUI, multiple windows can be opened simultaneously on iOS on iPad, Android, Windows, and Mac Catalyst. Xamarin does not offer this support.

Conclusion

.NET MAUI is an upgrade from Xamarin Forms and offers various advantages to create cross-platform apps. It is a step towards achieving the goal of developing apps that run seamlessly on all platforms without having to deal with different frameworks, programming languages, and compilation processes.

Want to migrate your existing Xamarin apps to .NET MAUI? We can help. Connect with us at connect@amantyatech.com