If you’re new to Xamarin (or not), one of the first decisions you’re faced with when starting a new project is whether to use Xamarin.Forms or Xamarin Native. In this article, we’ll go through descriptions of each and which situations are suited best for one or the other.
First, what is the difference?
Image Source: Xamarin Docs
Xamarin.Forms is a way to write your app in C# once, and it will run on both Android and iOS through a shared code base for the logic AND the UI. Xamarin.Forms runs on top of native platforms.
Xamarin Native creates a wrapper around the native APIs for each platform which allows the same look and feel of an app that was built without Xamarin. But, Xamarin developers can build both Android and iOS in C# and have access to the tools offered in the C# community. Xamarin Native requires that you build each app separately, but also allows for more specific configuration for both Android and iOS.
But what about speed?
Altexsoft did an extensive test on speed of native apps, Xamarin Native apps, and Xamarin.Forms apps. You can see the full report here . For bootup speed, native apps are always faster, followed by Xamarin Native apps, and finally Xamarin.Forms.
Image Source: Altexsoft
You will also notice that Android and iOS have significantly different speeds. This is something to keep in mind for your project and whether your users are more likely to be using Android or iOS.
Secondly, if your app is retrieving its data from a REST API, you’ll be concerned about those speeds as well:
Image Source: Altexsoft
Here, the speeds between Xamarin and native are more similar. In fact, Xamarin Android is even a bit faster than the native Android apps.
With all this information, here is a quick guide for when to use each product.
Situations best suited for Xamarin.Forms:
• Apps requiring little platform specific UI • Apps that need to be built quickly • Apps that require heavy code sharing
Situations best suited for Xamarin Native:
• High level of platform specific UI • Apps that need to be as small and as fast as possible • Apps that require platform specific UI
At the end of the day, there is no wrong choice, Xamarin is best way to build your cross-platform mobile apps.
If you want to dive deeper into Xamarin.Forms or Xamarin Native, read up on the docs here.
2 thoughts on “Xamarin.Forms vs Xamarin Native”
This may have different results with some of the newer bits released. See https://devblogs.microsoft.com/xamarin/faster-startup-times-with-startup-tracing-on-android/