Visiting MAUI

It’s been a few months since my last post, which is not necessarily what I intended, but I took some time off at the beginning of the year before jumping into new ventures. Since then, I’ve been quite engaged coming up to speed with a new team and getting going on some data architecture challenges. There have also been a lot of meetings and a good bit of family time.

Those who have followed this blog for a long time know that there was a time when I was doing a lot of .Net work. In a previous life, I did a lot of federal contracting and that world is very Windows-centric and .Net is a common platform. The last few years have offered little opportunity to work with it, though I did do some server-based work in .Net core that ended up running in production in Alpine containers on AWS. That solved a specific business need and I didn’t need to touch it much after it was deployed.

I do still like to keep one eye on the .Net world, mainly out of nostalgia, but also because Microsoft has been quietly innovating away while the rest of the world talks about Go and Rust, and keeps their legacy Node apps running. Also, despite containers and serverless and microservices being all the rage, I still have a soft spot for the old-fashioned desktop app. This owes mainly to the fact that each computer I buy is more powerful than the last, yet most apps treat it as a dumb terminal. When I experiment, it’s usually on the desktop. It’s a great way to prove out some logic before “promoting” it to a cloud and dealing all the boring infrastructure issues that entails.

Given all of that, .Net MAUI (Multi-platform App UI) grabbed my attention. While .Net has been cross-platform for a number of years now, MAUI finally delivers on that promise for user interfaces, meaning it’s possible to develop apps for Windows, MacOS, and mobile platforms. I decided to kick the tires. My extremely early results have encouraged me to dig deeper.

My first app is really quite simple. It displays a map (Esri ArcGIS Runtime) and allows me to type the name of a location. It then makes a request to the ChatGPT API to get the latitude and longitude of that location along with a 50-word description. With the payload, it re-centers the map to the point of interest and displays the description. The goal of this test app was to perform a task so simple that it would be self-evident that it was working correctly. That way I could focus more on the cross-platform aspects of MAUI.

I chose ArcGIS Runtime because Esri already has MAUI-specific controls that target MacOS, Windows, iOS, and Android. There are other map controls for .Net, but this one has specific MAUI support so I could reduce my workload there. I decided to use the ChatGPT API simply because I was looking for an excuse to use the ChatGPT API. This use case is probably underkill for ChatGPT and ChatGPT probably isn’t the best way to perform this task, but I am simply experimenting at this point.

I’m doing my work in Visual Studio Community for Mac, version 17.5.4, with MAUI support installed. The various images show the app running natively on MacOS and inside Android and iOS emulators. In my first pass, I didn’t need to do anything platform-specific, other than change the build target. I am beginning to work with device location services, camera, and media libraries. Those require platform-specific configurations to request the necessary permissions from the user, but those configurations seem to be pretty well isolated.

On mobile platforms, I am at the emulator stage. I am approaching the point where I will try to deploy to physical devices and see what issues that may introduce. I am currently building a single app, but I probably wouldn’t do that “for real.” UI idioms are different between mobile and desktop so, right now, I’m essentially deploying a mobile-like UI to desktop platforms. I’d probably try to bifurcate that a bit going forward, but this is fine for now.