A Quick Look at the .NET MAUI (Multi-Platform User Interface) Library

I was updating my Microsoft Visual Studio program and decided to take a look at using the .NET MAUI template. Suppose you want to create an application that runs on a Windows desktop machine, and a Mac machine and an Android phone. You could write the application three times, which is difficult and ugly but in many cases is the best approach to take.

Or you can use MAUI to write the application once and it will build three versions for you. At least in theory.

The idea is that MAUI gives you a single set of APIs that are wrappers over the low level platform implementations for each target platform. I’ve looked at MAUI documentation and it’s very complex.

MAUI is the successor to Xamarin Forms which had the same purpose. The problem with Xamarin, and presumably with MAUI, is that writing a single set of code for multiple platforms is really difficult and complicated. For some applications, learning Xamarin and dealing with its quirks and bugs was more difficult than just writing different versions of the application.

I launched Visual Studio 2022 and updated it to the most recent 17.3.3 version. Then I launched the Visual Studio Installer program and added the MAUI workload.

I restarted Visual Studio and selected the basic MAUI application template. The template code gives a dummy application where you can click on a button and the app keeps track of how many clicks have been made. I selected the Windows Machine emulator and clicked on the green Run arrow. The application built and ran without trouble.

I think the most interesting factor related to MAUI is the cost-benefit analysis regarding when to use MAUI and when to bite the bullet and implement separate code bases for each target platform. If you only have two target platforms, say Android and iOS, then separate code bases are quite manageable (but by no means trivial). If your application is very complex, then MAUI will have inevitable glitches. But there’s a sweet spot combination of number of target platforms and application complexity where MAUI would be a good choice.

Hawaii became a popular travel destination for wealthy Americans starting in the 1930s. The Matson shipping company operated elegant white passenger ships Matsonia, Lurline, Mariposa, and Monterey. Artist Frank McIntosh (1901-1985) created beautiful menu covers for the ships’ dining rooms.

This entry was posted in Miscellaneous. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s