Multi-platform App UI

Last updated: 2024-05-03
MAUI stands for 🎬
M
ulti-platform
A
pp
UI
🎬
For C# developers, it's an edge technology by Microsoft for building multiple apps with the same codebase
  • mobile apps: iOS, Android.
  • desktop and console apps: Windows, Mac
  • samsung apps: Tizen based smart TVs
  • linux apps: server and console apps only. Those ones are very fast !
    • For hosting web api, this is my 1st choice. This is much better that windows servers.
    • C# console apps run on both arm64 (raspberry pi, …) and amd64 (intel, amd, …).
Honestly, today with Maui you essentially build mobile apps.
Maui apps are compiled. That means they are fast, but while developing you need to rebuild and deploy the whole app after making a change to the code. Maui apps do support live update of the UI during development though.
Maui replaces Xamarin, while being faster and modern.

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

Installing an IDE

Coding using the command line
does work
but is totally 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.
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 manually store the build number to increment it.
Total build time for a maui Android or iOS app is around 10mn.
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 developer on this product ⇒ no investment ⇒ a promise of bugs and sweat, low speed updates, and horrible hours.
If you still want to go that 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 🗙