Building Xamarin Forms Mobile apps using M1 Macbook Air - A Developer's Perspective

The original article posted on 28-Jul-2021 (after one week of usage) represents initial impressions. Updated on 14-Aug-2021 to reflect after 3 weeks of extensive use.

 

Last week, I replaced my 15" Macbook Pro (Late-2017 Model, Core i7, 16 GB RAM, 512 GB SSD) with M1 Macbook Air (8-Core GPU, 16 GB RAM, 512 GB SSD), and boy-oh-boy, am I impressed? I also have a full-blown iMac Pro at home (7th Gen Core i5, 32 GB RAM, 1 TB NVMe, and 27" 4K Monitor) which I use primarily for Xamarin development. I used to be a hard-core Windows user for the past 20+ years, but bought my first Mac device (the MBP laptop) 3 years ago to aid in Xamarin development (you cannot build/publish iOS apps using Windows machines). I was so impressed with MacOS (the performance and stability), that I replaced my home Windows desktop with iMac Pro soon after. And I have never looked back to Windows ever since. [I did try Windows 11 Preview recently in a VM but could not see a reason why I should give up the great Mac experience] 

When Apple announced the plans to transition from Intel to its own Silicon last year, I was a bit skeptical. However, after reading all the great reviews of M1 devices and of course, watching lots of videos on YouTube, I decided to take the leap of faith. "What's the worst that could happen?", I asked myself. I am only planning on replacing my MBP with MBA; my powerful desktop is still with me, right? And man, was I wrong?

Spoiler Alert! After using the M1 MBA for a week, I am not sure if I want to continue using my so-called powerful iMac Pro anymore. M1 is just that good (I will explain below)! Of course, I will still continue using my desktop as I cannot see myself working on a small 13" screen with no full-blown keyboard and mouse. But who knows, I may connect my monitor and external keyboard/mouse to the MBA and make it my primary machine in the future. Time will tell.

[Update on 14-Aug: The M1 MBA is a great machine overall, but I cannot seem to move away from the comfort of a full-blown desktop machine for heavy usage and continuous development tasks]

 

Before I dive into the specifics of using M1 MBA for Xamarin development, I want to share my experience of using this laptop after a week.

What I LIKE

  • The battery life is just AMAZING. When I received the laptop and unboxed it, it was around 90% charged. As a first step, I upgraded Big Sur from 11.3 to 11.5 (that's a download of 6GB+ and installing it). Next, downloaded and installed Xcode (11GB+), VS for Mac (3GB+), Office 2019 (3GB+), UTM with Windows 10 (10GB+), Docker with SQL Server (2GB+), VS Code, Chrome, Edge, Postman and many more. Took me around 9-10 hours, and the battery dropped from 89% to just 42%. WOW!!! In fact, post this I fully charged my laptop and then used it for the next 3 days (moderate usage of 4-5 hours a day - as I usually did with my MBP), and still it was left with 30% battery. And I did not charge the laptop in between. With my MBP, I could never imagine using it for 3-4 hours (let alone days) without connecting the charger. Now, I do not need to worry about carrying the charger with me in the bag (unless I am traveling and out of the country for more than 3 days). Btw, the charger that comes with MBA is small, so I wouldn't mind sticking it in my bag as it is hardly noticeable. [Update on 14-Aug: The battery is just amazing. I recently started teaching Xamarin Forms course to kids over the weekend. 3 hours sessions, which usually over-ran by 15 mins or so, and additional 30 mins before the start to get everything prepped up. So around 4 hours of usage almost. I charged my MBA to 100% before starting Day 1, and at the end of Day 2, I was left with 30% battery. And I was running PowerPoint, VS for Mac, iOS simulator and Android emulator extensively. Just great.]
  • The boot time is fast. The wake from sleep is instantaneous. No frustration on waiting for a few seconds for the device to be available for consumption. Couple this with the TouchID sensor to unlock; no need to enter password (at least on my iMac Pro).
  • No more vacuum cleaner sound coming from the MBP. It's a fanless machine. Pin-drop silence. In fact, if I have to play the devil's advocate, I would say that I am so much accustomed to working in environments with fan-noise coming from the laptops or desktops that I found it disturbing to work in a quiet environment and it was counter-productive (I was actually distracted by the silence).
  • Performance is just amazing. All the native apps and M1 optimized apps are super-fast. I wouldn't even try to give numbers to compare them to Intel versions on my MBP or iMac Pro. Just take my word for it, or search for reviews on YouTube comparing the same. VS Code loads instantaneously. Docker is super-fast. Wish Microsoft rolls out the M1 version of VS for Mac soon. I know it is in the roadmap, but no ETA has been announced. Looking forward to it, as this is the main thing  I use day-in-day-out. [Update on 14-Aug: After 3 weeks of usage, I would say that this claim is over-rated. On paper and during benchmarks, M1 does have an edge (maybe a huge one), but in practicality, I would say that a few milliseconds (or even a second) don't count. How many times you open the apps?? While using the apps, both M1 and Intel versions perform almost similarly.]
  • You do not need to keep the laptop plugged in to get max performance. Unlike Intel devices (Macs or Windows) which throttle down when running on battery, M1 chips do not have this issue. There is another issue with throttling on MBA which I will mention below, but not because of running on battery.
  • The new Magic keyboard on M1 MBA is great. It is so comfortable to work with. Don't get me even started on the horrible Butterfly keyboard on my older MBP.
  • And it runs iOS apps as well. My iOS app Series Watchlist works flawlessly on it.

What I DON'T like

  • Very infrequently, I need to use Windows as a virtual machine. I have been using VMWare Fusion for this purpose for the past 1 year. I actually had a subscription for Parallels for 2 years, but last year I canceled it and switched to the free VMWare Fusion. Unfortunately, VMWare Fusion or VirtualBox doesn't work on M1 Macs yet. Parallels has an M1 version but I don't want to pay $79 per year for something that I use very rarely (testing some windows software or connecting my Bitlocker protected external drives). I stumbled upon UTM which allows running Win10 ARM edition on M1. And it is free. But it is not without quirks. Overall the experience has been sub-par so far. VMWare hasn't provided a roadmap yet to make Fusion work on M1 chips. [Update on 14-Aug: I am starting to hate UTM. I think I should pay $79 and move back to Parallels.]
  • Visual Studio for Mac is not M1 optimized :(

What I HATE

  • Absolutely nothing.

Other thoughts

  • I have read a lot of reviews with people cribbing about the lack of ports; M1 MBA and MBP have only 2 thunderbolt/USB-c ports. I do understand that this might be a show-stopper for some, but for me I am least bothered about it. Usually, one of the ports is supposed to be used by the charger. But given the great battery life and no throttling of CPU when running on battery, this becomes a non-issue and the charger doesn't need to hog one of the ports. As a developer, I hardly have a requirement to connect any external device, and even if I do (e.g. external hard disk), the two ports are more than sufficient. Anyways, you do need dongles for Macbooks from 2016 onwards, when Apple switched to USB-c/thunderbolt ports only, to connect USB-A devices or HDMI-out or SD/mini-SD cards. I use this inexpensive hub from Anker (Amazon link) which provides me with extensions and extra ports. So no issue for me at all.
  • Since MBA is a fanless machine, it does (and is supposed to) throttle when under heavy load. And this affects the performance. But for me, I did not notice this issue. I mostly use it for Xamarin development with VS4Mac and casual browsing. While developing in the IDE, there is no load on the CPU. Only when you are running/debugging the app using the simulator, heavy load comes into the picture. But think about it; you run the simulator in small bursts only. So far, I did not notice any throttling or temperature shoot up above 42 degrees Celcius (average temperature is 30 Celcius for me under regular load). [Update on 14-Aug: I have seen the temperature shoot up to 72 Celcius occasionally. Mostly this is during the time when I am running emulators. But these bursts are very short and I did not notice any performance issues. The temperature drops back to 40s almost immediately.]

Setting up the laptop for Xamarin Development

Right, so let's get into the details of setting up the machine for Xamarin development.

  1. The first thing is to install Xcode (v.12.5.1 at the time of writing). Once installed, add your Apple Developer account and download profiles (if needed).
  2. I don't know if something changed with new version of Xcode, or if this is an M1 thing. Earlier, Xcode would prompt me to install Command Line Tools when I opened Xcode for the first time after installation. This time around, it did not. What this means is that without the command line tools installed, VS4Mac was not able to show me iOS simulators to debug my Xamarin apps. So, I had to manually download and install the command line tools from Apple Developer Account Downloads page.
  3. Install Visual Studio for Mac as usual.
  4. Android Emulators are not available by default on M1 machines as these are based on ARM-architecture. You will need to install the ARM version(s) of the emulator manually. There are many complex solutions available on the internet. However, I found this to be the simplest solution. Simply download and install Android Studio Arctic Fox RC. This automatically installs ARM64 version of the emulator, which is available by default in Visual Studio for Mac for testing and debugging. And it is fast as well :) [Update on 14-Aug: I noticed that VS for Mac will fail to launch or start the app on Android Emulator occasionally, which is frustrating. Couldn't figure out a pattern yet. But performance is great when it runs.]

Creating your first Xamarin Forms project

We are ready to start developing using Visual Studio for Mac on the new M1 machine now. There is no change to how you worked earlier. Everything remains the same. Just launch VS4Mac, create a new XF application and run it in either iOS simulator or Android emulator. Business as usual, really. On the performance side, it seems that my iMac Pro is slightly faster than the M1 MBA. Here are the results comparing the two:

Nothing in the numbers so far to side with M1 Mac. We need to test with bigger projects. I took my Series Watchlist project, cleaned up the solution, and tested it on both machines. Similar results again. iMac Pro performs better than M1 MBA. I tried it multiple times on both machines with similar results every time.

[Update on 14-Aug: I wouldn't pick between M1 or Intel iMac when it comes to Xamarin development. My experience is almost similar on both. However, I did notice a strange thing. When running the apps on iOS simulator on M1, the Splash Screen takes a very long time, and stays on the screen for almost 5-10 seconds before the MainPage shows up, compared to 1 second on iMac Pro.]

Closing Down

So in a nutshell, I can deduce that the new M1 Macbook Air (with 16 GB RAM) is slightly slower than my Intel based iMac Pro desktop (with 32 GB RAM) when it comes to Xamarin development using VS4Mac. This is contrary to some of the performance numbers I have been hearing about. I saw amazing numbers for people comparing NodeJS and Xcode on M1 machines, but those are using M1-optimized apps. VS4Mac is not M1 optimized yet. Still, these numbers are not that bad. How many times do you need to build or debug the app (maybe 5-10% of your total development time in a day)? I can live with it for the time being, given all the other amazing benefits I get from this new laptop. And with the M1 optimized version of VS4Mac 2022 coming up (hopefully soon), this could be solved altogether. And do note that I ran these tests against my iMac Pro. I had already sold my MBP, so I could not compare with that. But from my experience with MBP over the past 2-3 years, I am 100% certain that those would have been worst than either of these by a large difference.

I hope that this has been useful for Xamarin developers planning to switch to Apple Silicon. My personal experience so far has been great. I have always been a desktop person and use laptops once-in-a-while (while on the go). But my experience with M1 MBA over the past week seems to be driving me towards using this laptop more and more. It is way better than my MBP. Stay tuned, I might provide my experience after 1-2 months of extensive usage of MBA. Peace :)

[Update on 14-Aug: M1 MBA is a great machine while on the go. The battery life is just too good. Add to it the fan-less design with no aircraft engine sound (compared to the Intel MBPs), and you have a winner. The performance is mixed for me. Overall, the performance improvements (in some areas) and degradations (in others) are minor. I wouldn't even bother making that my decision point for using or not using this device. But when at home, I would stick to iMac Pro. No questions about that for now.]

Comments (2) -

  • 486777 509844I always was interested   in this subject  and nonetheless   am,  thankyou  for posting . 617626

Add comment

Loading