Mac Catalyst Support for Xamarin.iOS
TL;DR I have written a tool that will convert your Xamarin.iOS app (including Xamarin.Forms and MAUI) to a Mac app using Mac Catalyst. This makes creating a macOS app and selling it on the App Store easier than ever. If you sponsor me on GitHub, subscribe to me on Twitch, or support me through Patreon, I will send you a link to try a beta version of it.
A lot of what I’m about to discuss here was discussed on Episode 225 of Merge Conflict. Have a listen!
Twitch
I also have been live streaming this work on Twitch. You can see me getting it to work with Xamarin.Forms.
Fragmented Brain
Oh how time changes everything. When I first started programming, I learned to write apps in Visual Basic on Windows and thought it to be a wonderful canvas upon which build some cool stuff. I thought I would spend the rest of my life learning its ins and outs, mastering its UI, building my own UIs, and being happy.
But time changes everything. I abandoned my beloved VB, to learn MFC and fell in love with that. Then I learned Delphi and thought, finally, the one tool to rule them all. But I was wrong. The web came. All of a sudden I was breaking my UIs into servers and clients like it was the 1970s. And then iOS came into my life and I abandoned all of that for UIKit. But then Google wanted a piece of the action and thrust Android into the world and yet another UI framework into my brain.
I have been forced to learn too many frameworks in my pursuit to build cool apps. It’s been exhausting. :-)
Unification
So, when Apple announced a unification of their platform APIs with macOS Catalina, I was all ears.
Apple had decided to allow macOS apps to be written using UIKit as opposed to the mighty AppKit. The technology is called Mac Catalyst and is a port of Apple’s mobile libraries to work on Intel 64-bit Macs.
As I support multiple apps that release for both iOS and Mac, this decision has real economic repercussions for my business.
- It will allow me to add another store (another way to sell) my existing apps.
- It will guarantee that all my future apps will also be for sale on at least two stores.
- It will drastically decrease the amount of time I spend fixing UI bugs on mac.
- It will give me more time to focus on and improve the iOS versions of my apps.
All wins in my opinion. While I have grown to love AppKit, with Mac Catalyst, I’m not sure I’ll ever write another AppKit app again.
Lastly, Apple has introduced Apple Silicon macs that will also be able to natively run UIKit. In the same way UWP is Microsoft’s universal framework, UIKit is shaping up to be Apple’s.
Just one snag, I write my apps using Xamarin.iOS and Microsoft has not yet added support for Catalyst apps. Schedules and all that.
This delay was frustrating me and the opportunity cost was killing me, so I decided to take matters into my own hands and port Xamarin.iOS to Mac Catalyst. Fortunately, Xamarin and mono and .NET are all open source - the code is right there. You just have to be crazy enough to start editing it. :-)
It wasn’t easy, but with enough effort I was able to get it all working! (I would put a GIF here, but seriously no meme could capture how I felt.)
And now it’s time to share that work with everyone.
BETA
If you would like to convert your own apps to run on Macs, I have prepared a downloadable SDK/tool to do that conversion. I am making it available to people who support my OSS work. Namely, if you:
Then I will give you a link to the SDK. The SDK is just a little .NET Core tool that converts the iOS version of your Xamarin app to a Mac Catalyst version. “It just works”
This is an early version so you can also expect errors. That is to say, sometimes, it doesn’t just work. But so far it has been able to run my largest apps.
I hope you’ll give it a shot. It’s really fun seeing your apps work on Macs!
I haven’t tried releasing to the Mac App Store yet, that’s the next hurdle to overcome.
Contributing Back
I am working with Microsoft and the mono team to integrate this work into the product so everyone can use it. Schedules are still tight, and the world is still crazy so it will probably take a little time, but I’ll keep working on it!
On that front, the first big step has already been taken. I submitted a PR to the mono project, and it has been accepted!
Build makefile to support Mac Catalyst #20537
@akoeplinger Thank you, looks great!
I am so delighted! I have always wanted to be a mono hacker and now I am! :-)
Next steps are getting changes to Xamarin.iOS put in-place. These are small but require coordination with the build tooling so have to be done carefully.
In Conclusion
The future app development is looking bright thanks to Apple’s unification efforts, and Microsoft’s commitment to open source. I can’t wait to get all my apps onto Mac.
If you want to help me out, you can do so by buying my apps and by supporting my open source work. I’ll put those links here one more time. ;-)