Xamarin.Native vs. Xamarin.Forms

This post is part 2 of series of Xamarin.Forms – real life stories post.

Let’s start by defining Xamarin.Native (it’s not an official name). For me Xamarin.Native is combination of Xamarin.iOS, Xamarin.Android, and Xamarin.Mac. These 3 packages allow creation of platform specific UI in a way that very close to the way native apps are developed. The main difference is that it can be done using C# language. In addition, non-UI layers (e.g. business, communication, etc.) can be shared across multiple platforms if separated into PCL library. This approach enable us to fine-tune the UI for each platform without the risk to introduce bugs to other platforms. Also you can re-use those PCL libraries to create native Windows apps (Windows Phone, WinRT, UWP).

Xamarin.Forms provides an ability to re-use not only non-UI layers, but UI as well. Sort of “write once – run everywhere” idea. Also, there is an ability to customise some parts of UI for different platforms via Custom Renderers or Effects. Xamarin.Forms uses XAML technology similar to WPF or Window Store apps.

So which approach do we choose: Xamarin.Native vs Xamarin.Forms?  After examining the two different options and talking to number of Xamarin developers I came up with following set of criteria:

  • Xamarin.Forms is a default option for a new project
  • Choose Xamarin.Native when:
    • UI is different for different platforms
    • UI requirements are very strict and UI must be pixel perfect (It will be very hard to achieve this level of precision in Xamarin.Forms)
    • The core of the application relies on platform specific features and those features are implemented in completely different ways, i.e.: async/await functions vs. callbacks

Taking into account the project requirements, Xamarin.Forms looks to be the obvious choice. The application UI should be almost identical on all 3 platforms, not much of platforms specific features, screen design didn’t contain such complex elements like complex forms, flying elements, dynamic charts etc.


Read part 3 of this blog series: Xamarin Development Environment

Readify has upcoming events on Xamarin, Mobility and Cross Platforms: visit Readify.net/events to find out more or follow Readify on Twitter

Advertisements

4 thoughts on “Xamarin.Native vs. Xamarin.Forms

  1. Hello, so if I’m understanding your post correctly, you can write the logic in your app once in Xamarin and port it across all the platforms correctly. But if you want to have customised UI for Android, IOS, Microsoft, you will need to learn the code to create their respective UI and then include the respective UI in the final Android, IOS, Microsoft app?

    Like

    • The answer is: it depends.
      If you use Xamarin.Forms for your application, your logic as well as UI is re-used across multiple platforms.
      If you use Xamarin.Native (iOs/Android/Win/Mac), you can re-use your logic (you don’t need to port, you just use binary DLL) and you implement UI per platform using this shared library.
      Hope it helps

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s