While there is a documented upgrade path for Xamarin Forms apps to .NET MAUI, this doesn't seem to be the case for Xamarin for Mac, and support for Xamarin is ending as of May 2024. Is it then the case that Xamarin for Mac desktop apps need to be redeveloped from scratch? I can't see any way of converting the C#/link to XCode GUI development approach to .NET MAUI.
Have searched for an upgrade path for Xamarin for Mac apps to .NET MAUI, but haven't found one.
Starting with .Net 6, the Xamarin native APIs have been rebranded as .Net for (Platform name).
You don't need Maui, if you are only targetting one platform; all you need is the latest .Net, for that platform.
The essential decision is whether you will write "MacOS UI", or "Maui UI", or "iOS/MacCatalyst UI".
Answer #1: .Net Mac (aka .Net for Mac): just for MacOS
Upgrade Xamarin.Android, .., Xamarin.Mac to .Net:
For most apps, you won't need to change namespaces or undertake other rewrites.
To simplify the upgrade process, we recommend creating a new .NET project of the same type and name as your Xamarin native project, and then copying in your code. ...
Other useful links:
Install .Net on macOS.
Download .Net 7.0. For development, pick one of the MacOS "SDK"s; the one that corresponds to the Mac cpu you are developing on.
Answer #2: Maui: cross-platform UI including Mac
NOTE: Maui UI is like Xamarin.Forms UI; your Xamarin.Mac UI would have to be rewritten. This is the same as from any other Xamarin native platform code.
Maui UI is cross-platform UI classes, and supports XAML. (It can be completely written in C#; it is C# classes underneath, but most examples use XAML.)
Because it is cross-platform UI, AFAIK, this approach DOES NOT support Apple XCode/Storyboard/Nibs.
The only way to run Maui (cross-platform UI) on a Mac, is to use the iOS/MacCatalyst target.
Mac Catalyst is from Apple, and allows iOS apps to run on a Mac.
There is a lot of compatibility between iOS APIs and MacOS APIs.
HOWEVER, there are some limitations; some MacOS APIs are not reachable from iOS/MacCatalyst.
iOS-specific code goes in directory Platforms/iOS.
Most of your existing Xamarin.Mac UI code would get reworked into "custom handlers" in that folder.
Answer #3: .Net iOS: support Mac via Mac Catalyst
The third approach is to support all Apple devices, by developing an iOS app, and running those on a Mac via Mac Catalyst.
This may sound a lot like #2. The difference is that you are using iOS-specific UI classes, and use XCode to develop the iOS storyboard.
This approach seems to be a bit behind, in documentation and tooling.
At this time, unless newer docs and examples come out, I would instead do #2, but with more use of Platforms/iOS directory (less reliance on cross-platform UI, if you only care about Apple platforms). (Can also have an iOSMacCatalyst directory. Requires some custom lines in .csproj file.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With