The Evolution to .NET Maui
Supporting applications on a wide range of devices and platforms can be a mammoth task for developers. While Xamarin.Forms has been a great asset for Microsoft, .NET Maui will expand on its mobile app creation capabilities aiming to solve some of the most pressing developer challenges. Survival is all about change in this world, and it’s no different when it comes to technology, which is why this evolution is so vital. On target to be finally released to the masses in Q2 2022, .NET Maui looks set to make a real difference to App Developers. At XAM we love Xamarin development and are excited to start building production applications in .net MAUI development.
What is .NET Maui
Microsoft is aiming to create a single .NET framework that will combine all the tools developers need to build amazing cross-platform software. A big part of this is replacing Xamarin.Forms with .NET Maui (multi-platform app UI) .NET Maui will allow XAM developers to build native Android, iOS, macOS and Windows applications from a single codebase. UI controls have been built from the ground up to provide unparalleled performance and resilience. What’s more, the evolution isn’t just aimed at mobile; one of the biggest parts of the development is to take the open-source, cross-platform framework to desktop.
Developer Benefits of Evolving to .NET Maui
.NET is already positioned to enable Brisbane developers to target a wide variety of app platforms. However, it has been in need of some unification. This is where .NET Maui looks set to come into its own; it promises a unified framework, new tooling and more flexibility for developers. Some of the key developer benefits include:
- Full Integration with .NET – since Microsoft bought Xamarin in 2016, the open-source platform has been fully available to developers. However, it never felt like a fully integrated part of .NET and Xamarin tooling has had some hitches in its time. With .NET Maui, whether you are developing for iOS or Android, it’s all baked into .NET itself. Fundamentally, it’s the .NET way of doing cross-platform development, rather than just another choice amongst many. Runtimes will be unified in .NET 6 and tooling will enable developers to have complete confidence.
- Suitable for Desktop Applications – Xamarin.Forms was largely created for iOS, Android and other mobile platforms. Reaching the desktop hasn’t been impossible, with renderers for Windows and Mac, but they have never been embedded with confidence. In the newly formed .NET Maui, desktop is upfront and central along with the mobile platforms with Windows and Mac Support out of the box. That’s not to say they’ve unnecessarily tried to reinvent the wheel. .NET Maui reaches desktop using established frameworks to quickly grow developer confidence. What’s more, developers can now officially target mobile and desktop apps from the same codebase.
- A single Project for All Platforms – with Xamarin.Forms, developers have one shared.NET Standard library and platform-specific projects for each platform. This can lead to cumbersome projects with lots of platform-specific things required in each project. .NET Maui hopes to solve this by delivering a single project. It should allow builds to be smarter, sharing resources across platforms. However, developers will still be able to override the system and create something customised for a single platform if needed. The result, however, will be much more elegant.
- Much Improved App Architecture – .NET Maui apps are bootstrapped using the .NET Generic Host Builder. This delivers consistency with the rest of NET, provides the ability to configure fonts and services, and enables apps to be initialised from a single location. In addition, apps now render native UI on each platform instead of requiring renderers that have dependencies and are difficult to customise.
- Simple Access to Platform Specific APIs – while today’s mobile devices are full of sensors, developers shouldn’t have to write native code to access them. .NET Maui Essentials is the evolution of Xamarin.Essentials and will abstract all of the platform-specific device APIs into a single library. As the solution is built right into .NET Maui, the cross-platform device APIs are visible straight away from the C# code.
- Code Change Visualisation with Hot Reload – one of the difficulties with Xamarin.Forms has been that it takes too long for developers to make code changes while the app is running and see them on simulators or devices. Hot Restart helped a little, but it didn’t compare with other cross-platform solutions. Now, Hot Reload has been developed as the quickest way to see code changes without full recompilation. While it will only work with .NET Maui XAML for now, in the long term, it should work for most C# code changes too.
- Improved Toolkit Experience – many developers use the Xamarin Community Toolkit to augment their experience. The toolkit gives them a solution out of the box to save writing repetitive code. However, while already popular, the solution is getting a makeover with the .NET MAUI Community Toolkit. The new set of libraries will further improve the experience with animation, behaviours, converters, common UI controls and more.
- Competent UI Stack – the .NET ecosystem already knows how to do cross-platform UI really well, and this will be extended across desktop applications. What this means is that .NET Maui will provide complex, performant UI components required for enterprise apps out of the box, enabling apps to be developed faster than ever.
- Support with Migration and Modernisation – with many businesses looking at modernising legacy apps, .NET Maui has created some interesting opportunities. The .NET Upgrade Assistant can help runtimes be updated to .NET 6, delivering a staggered approach to modernising the UI. However, desktop apps can also be moved to help reach platforms outside of Windows while reusing as much existing code as possible.
The Future of .NET Maui
The evolution to .NET Maui looks set to deliver many benefits and make developers’ lives a lot easier. There will be no more frustration of working with multiple projects, improved architecture will deliver consistency and apps will be able to grow beyond mobile platforms into desktop applications. Ultimately, .NET Maui will further simplify and streamline development while improving on performance and inspiring developer confidence in the modern .NET.