.NET MAUI vs. Xamarin: Should you make the switch?

With the recent release of .NET MAUI, a new framework for building multi-platform applications, many developers are considering making the switch from Xamarin. In this blog post, we’ll take a closer look at both frameworks to help you determine which one is the right fit for you.

app store

When it comes to cross-platform apps, Xamarin has been a popular choice among developers for many years. There is a new contender, however: Microsoft recently introduced the “.NET Multi-platform App UI” (MAUI). While the framework grew out of Xamarin.Forms, it promises to simplify the process of building cross-platform apps even further.

Whether you should switch from Xamarin to MAUI, though, depends on several factors. Let’s dive right in.

What is Xamarin?

Xamarin is a development framework using the programming language C# and has been around since 2011. However, its roots go as far back as 2001, with efforts to develop a Linux version of Microsoft’s .NET Framework.

In 2016, Microsoft bought the company Xamarin, along with the SDK of the same name. Xamarin thus became part of Microsoft Visual Studio, and switched to the open-source MIT license.

With Xamarin.Forms, you can write apps in C# for Android, iOS, macOS, and Windows using a single shared code base. With some additional tweaking in the platforms’ own programming languages, you can achieve near-native performance. This makes it a viable alternative to other cross-platform frameworks like Flutter and React Native.

Recently, Xamarin.Forms was integrated into Microsoft’s .NET MAUI framework.

What is .NET MAUI?

.NET MAUI is Microsoft’s next step towards simplifying cross-platform app development. Like Xamarin, the newer open-source framework lets developers create native user interfaces and applications for iOS, Android, macOS, and Windows using a single codebase.

However, MAUI promises better performance, increased productivity, and a more streamlined developer experience than Xamarin.Forms. It is built on top of .NET 6, which brings improved performance and features across all platforms.

The framework was officially released in 2022 and is planned to replace Xamarin entirely by May 2024, when Microsoft will end support for all Xamarin SDKs.

Differences between Xamarin.Forms and .NET MAUI

Though MAUI is a successor to Xamarin.Forms, there are some notable differences between the two frameworks, which currently still co-exist.

Xamarin.Forms.NET MAUI
One project per platformOne project for all platforms
MVVM architectureMVU architecture
Workarounds for accessing native resourcesDirect access to native platform APIs
UWP UI (tied to Windows releases)WinUI (frequent updates)

One project for all target platforms

With Xamarin, developers have to create a dedicated project for each platform they are developing their app for (Android, iOS, macOS, and Windows). With .NET MAUI, one project covers all platforms, with resources like fonts and images stored in a single location.

MVU instead of MVVM

Model-View-Update (MVU) and Model-View-ViewModel (MVVM) are architectural patterns that separate an app’s presentation logic from its business logic.

While MVVM, used by Xamarin.Forms, is more established among developers, MVU is gaining popularity. Its key advantages are its simplicity and the immutability of the app state. MAUI’s use of MVU makes it easier for developers to add new features without getting into conflict with other parts of the app.

Platform-specific APIs

While Xamarin.Forms provides APIs that work across all platforms, some platform-specific APIs are unavailable or require workarounds. With MAUI, developers can access native functionalities using a set of platform-specific APIs. These include utilizing a device’s sensors, copying and pasting text to the system clipboard, and storing data securely as key-value pairs.

UWP vs. WinUI

Whereas Xamarin.Forms relies on the UWP UI framework, .NET MAUI instead uses WinUI, which is decoupled from the release schedule of Windows. That means developers using MAUI generally have a more current and frequently updated UI framework to work with.

Should you switch from Xamarin.Forms to .NET MAUI?

MAUI still has to prove itself as a cross-platform tool. The Xamarin community, on the other hand, has had many years to get comfortable with its framework of choice. This makes it hard to recommend one over the other on merit alone.

However, support for Xamarin SDKs will end in 2024. Therefore, any new development projects should probably use .NET MAUI, as migrating the code later will present its own issues.

For existing apps, developers should familiarize themselves with MAUI sooner rather than later. While Microsoft removing official support does not spell the end of all Xamarin apps, .NET MAUI is a future-proof option.

Introducing the Scanbot .NET MAUI SDK

To complement our Xamarin SDKs, we’ve also introduced .NET MAUI versions:

If you would like to learn more about how to migrate your app from Xamarin to .NET MAUI, get in touch.

Up for a small project?

Try integrating our example app into your .NET MAUI project!

FAQs

How does the transition from Xamarin to .NET MAUI affect the existing Xamarin community and the availability of community-generated resources and support?

The Xamarin to .NET MAUI transition aims to bring the Xamarin community forward, enhancing the ecosystem with more robust support and resources. Microsoft’s commitment ensures a smooth migration path with updated documentation and tooling.

Are there specific examples of applications or case studies where .NET MAUI has been successfully implemented, highlighting its advantages over Xamarin?

While there are not yet many case studies, .NET MAUI’s introduction reflects Microsoft’s aim to provide a more modern framework for cross-platform development, potentially offering better performance and a unified development experience compared to Xamarin.

What are the learning resources and development tools available to facilitate the migration from Xamarin to .NET MAUI for developers?

Microsoft and the developer community have released comprehensive guides, tutorials, and documentation to facilitate the transition from Xamarin to .NET MAUI, focusing on the differences and new capabilities to assist developers in adopting the newer platform efficiently.

Developers, ready to get started?

Adding our free trial to your app is easy. Download the Scanbot SDK now and discover the power of mobile data capture