The world of cross-platform app development is undergoing a major revolution right now thanks to .NET MAUI—the next evolution of Xamarin.Forms.
Using .NET MAUI, developers can build a single project and compile it into native code and native UI components running on a broad array of platforms including Android, iOS, MacOS, and Windows.
What Is .NET MAUI?
If you are a .NET developer, then you know how awesome Xamarin.Forms is for building mobile apps for iOS, Android and Windows. You also know that it does not support every platform out there (for example, MacOS). Well now there’s an even better option–NET MAUI!
.NET MAUI stands for the .NET Multi-platform App UI, and it is built right into .NET 6. It is a major evolution of Xamarin.Forms, which allows developers to write code once and run it on all the most popular platforms, both mobile and desktop.
What does that mean? Basically, .NET MAUI allows developers to create apps in C# that will work seamlessly across all these platforms without any additional coding required! They just simply write one set of code and run it everywhere!
New in .NET MAUI
Below are some of the most interesting features and changes in .NET MAUI when compared to Xamarin and Xamarin.Forms:
- Mac Catalyst support – developers can now target MacOS desktop apps with their .NET MAUI projects
- Platform architecture – .NET MAUI is built right into .NET, and doesn’t require a special type of .NET (Mono) to run it
- Single project – Xamarin developers will know the pain of having to create separate projects for each targeted platform, and then one project for shared code. Now you can build cross-platform apps in .NET MAUI in a single project that targets multiple platforms, plus MAUI still allows you to write platform-specific code if needed.
- Dotnet CLI support – Your .NET MAUI project can now use the .NET CLI at the time of development, building, testing, and deployment.
- .NET Hot Reload – One of the coolest new features in .NET is the ability to hot reload nearly every kind of project, and .NET MAUI is no exception. This greatly speeds up the inner development loop for your day-to-day tasks as a developer.
- Handlers vs Renders – Microsoft have introduced a new UI programming model that works much better for abstraction of the specific UI based on something called handlers. There is backwards compatibility for your renders, so that makes it easier to start migrating your Xamarin projects.
- .NET 6 – One of the best things about .NET MAUI is it’s built right into .NET 6, meaning you get all the great features and libraries available to any .NET 6 developer.
- Shared Resources – You can now share resources such as images and fonts between all your projects in a single location.
- Accessibility – supporting accessibility was a little bit of a hack in Xamarin, but now it’s a first-class citizen in .NET MAUI using semantic properties to provide accessibility values on all targeted platforms.
- Adds MVU pattern to MVVM and RxUI – in addition to the popular model-view-viewmodel and reactive UI patterns, .NET MAUI now also supports the MVU (model-view-update) pattern.
- Blazor support – If you’re developing a Blazor web application, you can also host that app inside a .NET MAUI container and run it cross-platform.
- Multiple windows for Windows, MacOS, Android, and iPad – any real desktop application needs to be able to support multiple simultaneous windows, and now you can do that with .NET MAUI apps as well.
The Future of Xamarin
The name Xamarin may start to fade now, but, as part of .NET unification, Xamarin.iOS and Xamarin.Android live on inside .NET 6. However, in their new home they are now known by the names .NET for iOS and .NET for Android.
Xamarin.Forms is evolving into .NET MAUI, but don’t fear for your Xamarin.Forms projects. Microsoft will continue to support Xamarin.Forms until May 1, 2024. After that time, apps built with Xamarin.Forms will continue to work and be maintainable, but there will be no new releases of the platform or official support from Microsoft.
Migrating to .NET MAUI
Microsoft has made migrations as easy as possible for Xamarin.Forms developers. If you’d like to read more about it, check out Microsoft’s documentation on upgrading.
Trailhead and .NET MAUI
Trailhead was a Xamarin partner even before Microsoft bought it, and we will continue to use its newest evolution–.NET MAUI–to build amazing cross-platform experiences on desktop and mobile devices.
If you need any help upgrading your Xamarin apps, we’d be happy to guide you through the process or do it for you.
Conclusion
The future of building multi-platform apps is here today with .NET MAUI! If you’re already a Xamarin developer, you get a leg up, because there’s a very straightforward path for you to upgrade your skills and your apps to .NET MAUI.
Welcome to the future of cross-platform development in .NET MAUI. Trailhead is here to help you get started down the best path.