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.