Last week when we hosted a community day in Stockholm with .NET on mobile devices in focus. One of the big discussions what about what tools and frameworks to start with for a developer that is new to mobile app development. That discussion inspired me to write this blog post about why to use Xamarin in 2019!
What is Xamarin?
First of all, we need to remember that Xamarin and Xamarin.Forms are not the same, but often people talk about them as they are the same. I would define Xamarin.Forms as a framework for building UI for multiple platforms with a shared code base. Xamarin (including Xamarin.iOS, Xamarin.Mac and Xamarin.Android) is a platform that makes it possible to use C# (and even F#) for developing native apps for iOS, Mac, and Android.
Why should I use Xamarin if I'm new to mobile app development?
If you are a .NET developer it is pretty easy choice. You already know C# and maybe also XAML, you only have to learn a new platform. If you want to develop apps for iOS and Android and want to use the tools from Apple and Google you first need to learn two new programming languages, Objective-C or Swift for iOS development and Java or Kotlin for Android development. When you have learned the languages you also need to learn to know the platforms and the API:s. But that is not all, you also have to learn two new IDE:s, with Xamarin you can use Visual Studio to develop apps for both iOS and Android.
Why use Xamarin if you're I'm not a .NET developer?
You maybe think that there is no reason to learn Xamarin and C# if you are not already a .NET developer. Even if you only want to target one platform when you start to develop apps you probably want to take it to more platforms later, especially if your app is becoming popular. If you have used Xamarin and separated code for UI from your business logic the step to the next platform is much faster to develop the app for the second platform. And if you also developing your backend with .NET you can even share code with your backend.
But what about Flutter and React Native?
Both Flutter and React Native is in many ways great and makes you develop apps fast. But with Flutter you will get a UI that is drawn (with Skia), instead of using the native UI-components as Xamarin.Forms do. Personally, I prefer the native UI.
Neither Flutter or React Native will have 100% API access to the native platform, that means that if you want to use native features that not are supported by Flutter or React Native you have to create your own bridge/plugin for that. To do so you have to use Objective-C/Swift and Java/Kotlin. With Xamarin you will have 100% API access which means that you can use C# for everything that the platforms offer to developers.
You should also remember that both Flutter and React Native are pretty new and Xamarin and Xamarin.Forms have been out there for many years now and have been very mature.
Should I use Xamarin.Forms or Xamarin with native API:s
My recommendation is to always start with Xamarin.Forms, even if there are limitations in what you can do with Xamarin.Forms it is architected in a way that it is easy to use the native API:s if you want to create something that you cannot do with Xamarin.Forms.
In the short run, you will probably make better apps in the languages and tools that you already are comfortable with, but for the long run, I would say it is worth going with Xamarin even if you not are a .NET developer. If you already are a .NET developer, Xamarin is the way to go in all situations.
And finally, you can fuck up regardless of what platform you are using! It is possible to write bad code in all languages! And the most important thing for success is not what language and tools you are using, it is to learn to know your users/customers to deliver a great user experience.