Introduction to .NET MAUI

Frameworks are a great way to expand on vanilla .NET capabilities.

What is .NET MAUI?

.NET MAUI is a framework that provides cross-platform (iOS, Android, Windows and macOS) development of applications. It aims to provide “write once, run anywhere” support for each of the platforms, similar to Java. Where it differs from Java is that it builds to native code, either via JIT (Just In Time) or AOT (Ahead of Time) compilation, depending on the target platform.

What’s So Good About It?

It’s .NET!

.NET is very mature. It has been around a LONG time. .NETs popularity has gained even more since it became open source and runs on many OSes (not limited to Windows). C# has evolved into a very complete and useful language. If you are a C# developer, you will feel at home using .NET MAUI since it uses familiar build tools and .NET constructs.

The MVVM Pattern

The MVVM (model-view-viewmodel) pattern is similar to MVC (model-view-controller), but it is more geared toward developing mobile and desktop applications than the MVC pattern. MVVM is more event-driven and makes use of the “observable” pattern. MVVM also makes it easier to reuse components as things are, in general, more decoupled than in an MVC pattern.

Native

Because .NET MAUI compiles to native code AND makes use of native toolkits, it provides a good look and feel experience for users, regardless of the platform they are on. For example, on macOS, MAUI makes use of “Mac Catalyst” (which is developed by Apple). On Windows, .NET MAUI targets WinUI 3 which is the standard framework for creating apps on Windows (starting with Windows 10 and higher).

Many target audiences for applications want and expect an application that acts and behaves like other apps they have on their platform and .NET MAUI provides that experience. .NET MAUI also has support for adding custom code and interfacing with platform specific APIs for areas which .NET MAUI does not provide support directly in the framework.

Comparison with Other Frameworks

React Native

React Native UI development is similar in some respects. It has an XML/HTML based mechanism for authoring user interfaces, and has many familiar constructs for creating widgets, controls, etc. However, React Native is similar to its web counterpart in how it maintains state for an application. You maintain state for your application through passing “props” and “state” hook. React controls and views maintain their state through this hook (in an otherwise stateless framework). If you are accustomed to how state works in things like React, Angular, etc. then this will be very familiar to you.

Flutter

Flutter is similar to React Native in how you keep state and how it renders what’s in your “DOM” based on what has changed in your state, etc. However, the main difference between Flutter and React is that your UI is generated entirely within code (similar to how SwiftUI works on iOS/macOS, etc.).

Out of all the frameworks, Flutter has now matured enough where you can basically run it anywhere (macOS, Windows, Linux, mobile OSs and even in a browser).

Xamarin

Microsoft touts .NET MAUI as an “evolution of Xamarin.Forms”. Xamarin is not awesome when it comes to cross platform support. Each platform (OS) that you are targeting ends up being a separate Xamarin project, and maintenance can be a pain. .NET MAUI takes a more pragmatic approach by having platform-specific stuff under folders within the same project. Assets (images, fonts, etc.) stay nicely together.

.NET MAUI has primary support for more platforms (macOS, iOS, Android and Windows) whereas Xamarin only fully supports iOS, Android and Windows. .NET MAUI also supports .NET CLI for all of its build tools. Xamarin requires .NET Framework.

For .NET developers, .NET MAUI is an obvious choice for over Xamarin for the development and deployment of new applications. Xamarin, in general, should only be an option for legacy applications already developed in Xamarin.

Conclusion

While .NET MAUI is relatively new (release in 2022), it makes use of many existing and mature technologies that have been around for a long time (.NET, XAML, C#, etc.). Given that it is open source and has the backing of Microsoft, it should prove to be a solid option for mobile development, in particular, those developers who already have investments or expertise in the .NET ecosystem.

Resources

Microsoft’s .NET MAUI 7 Documentation - https://learn.microsoft.com/en-us/dotnet/maui/?view=net-maui-7.0

MVC vs. MVVM - https://www.guru99.com/mvc-vs-mvvm.html

The JBS Quick Launch Lab

Free Qualified Assessment

Quantify what it will take to implement your next big idea!

Our assessment session will deliver tangible timelines, costs, high-level requirements, and recommend architectures that will work best. Let JBS prove to you and your team why over 24 years of experience matters.

Get Your Assessment