Multi-platform App UI

MAUI stands for 🎬
M
ulti-platform
A
pp
UI
🎬
It is a framework over dotnet to build apps with UI.
Last updated: 2024-05-03
For C# developers, it's an edge technology by Microsoft for building multiple apps having an UI with the same codebase:
  • mobile apps: iOS, Android.
  • desktop apps: Windows, Mac
  • samsung apps: Tizen based smart TVs
Other apps that can be created with C# but don’t need Maui, only dotnet are for example:
  • console apps: Windows, Mac, and Linux (adm64, and arm64 like Raspberry Pi)
  • server apps: mostly web API.
On Linux, dotnet server apps run so fast ! It is my 1st choice when it comes to stability and speed.
Honestly with Maui - today - you essentially build mobile apps.
Maui apps are compiled. That means they are fast, but while developing them you need to rebuild and deploy the whole app each time after making a change to the code. Maui apps do support live update of the UI only (xaml) during development though.
Note: Maui completely replaces Xamarin, while being faster and modern, as it’s based on dotnet core (version 8 at the time of writing) while Xamarin is based on the very old “.net 4”.

Installing MAUI

  • For Android you will need the Android SDK. Get it by installing Android Studio. Get Android Studio by using
    so it updates automatically. You will also need
    (JDK 21 is incompatible with Android at the time of writing).
  • For iOS you will need a Mac and xcode (get xcode from the Mac App Store)
Then open a command line and run:
dotnet workload install maui

Choosing an IDE

Coding using the command line
does function
but is highly inefficient.
Maui is supported by those 3
Integrated Development Environment
tools today:
  • Visual Sudio Code: for the poors
  • JetBrain’s Rider: for the pro.
  • Visual Studio Windows: only for Android, Linux and Windows apps. I was never able to build reliably from VS Windows using the remote build to mac feature (even with Rider which also has that feature).
Note: Visual Studio Mac does not support Maui. And is retired.
Conclusion: the must have tool is Rider.
If you still want to go the Visual Studio Code path, put a cross on the live UI update.

Warming up 👣

1st get a list of template projects to start with, or use your IDE to create a new project.

TBC

To be continued, stay tuned !

Distribute (Build &, CI/CD)

Build and distribute using
That’s the best solution. Codemagic build machines are M1 (free) and M2 macs. Their Mac image contains all required tools including the multiple xcode versions. They are very fast to add new xcode versions, including beta versions.
They have a very clever shell tool that retrieve the latest build number used for an app on Apple App Store and Google Play Store. No need to store the build number to increment it. No more headaches when a CI is mixed with custom build pushed to the store.
Total build time for a maui Android or iOS app is around 10mn per app.
The pipeline is configured by a unique codemagic.yaml file that must be at the root of the git repository. It contains a list of jobs. A job can be triggered by tags, branches, api and manually.
A caching feature can cache up to 1GB of data between builds. For maui I did not find where to use it efficiently, even the nuget cache folder for a build is over 1GB (on my development machine it’s over 50GB !)
Distribute using Azure Pipeline
I don’t promote this solution, as the documentation is very light and not targeted on maui.
Also, after the Ms AppCenter retirement, I don’t trust that Ms product anymore. Some points tick my mind, like the doc which is very lightweight (with no mention of maui at all).
For me that means there is no will of pushing forward more this product, which means no more investment, which means it’s in maintenance mode, which is a promise of low speed updates along with bugs and sweat for users. I skip my turn.
If you still want to go that uncertain way, those extensions might be helpful:
,

Crashes and Insights

is the must have tool to get crash reports.
Sentry displays crash logs as readable (symbolicated) C# crash logs. It groups them so you are not flooded with the same logs. It automatically logs important device informations so you know excatly the scope of a crash.
Sentry also logs a breadcrumb that lead to a crash ! That breadcrumb includes what flow of pages appeared or disappeared before the crash happened. This is very useful to reproduce and crush crashes.
Sentry can also get and display logs that the app is posting using standard Microsoft ILogging. You get the important logs remotely !

References

An unhandled error has occurred. Reload 🗙