Difference between Xamarin.Forms and Xamarin Traditional

Sunday, July 09, 2017


A few days ago I was on Stackoverflow I was looking at some Xamarin related question, and I find this thread: https://stackoverflow.com/questions/43031120/difference-between-xamarin-forms-and-xamarin-cross-platform

... And I was not satisfied by the answers from community so I just sat down and start typing the my version of answer. When I realized that my answer is a bit longer I decided to "migrate" that text also to my blog post.

So this blog post will be in a form of the answer to the stackoverflow question.

Note: Also if you find this blog post helpful or you agree with me, go to the stackoverflow thread and up vote my answer ONLY IF YOU THINK THAT IT IS CORRECT!


Question: Difference between Xamarin.Forms and Xamarin Cross Platform


My answer:

When we talk about Xamarin there are two approach in development of native apps:

  • Traditional Xamarin approach
  • Xamarin.Forms
There is a good quote from Xamarin web site:

"Share code everywhere. Use the same language, APIs and data structures to share an average of 75% of app code across all mobile development platforms. Build user interfaces with Xamarin.Forms and share nearly 100%."


Important note is that these numbers can vary from project to project so this is some assumption for general usage of Xamarin.


And as you can see from image bellow about "differences" between these two approaches. Traditional Xamarin approach (Xamarin.iOS and Xamarin.Android) they’re both built on top of Mono, an open-source version of the .NET Framework. To develop those apps you use C# and there is a opportunity to share up to 75% of code base as you can see on image bellow and from quote from Xamarin.



Using Xamarin Traditional approach you can use a C# as programming language to write your models, call web services, etc. So you are writing that code logic once and using/share it across the Xamarin.Android and Xamarin.iOS projects, and in those separate projects you are writing code that is specific for that platform and you have access to their APIs.

Also there is a quote from Xamarin about traditional approach:

Anything you can do in Objective-C, Swift, or Java can be done in C# with Xamarin using Visual Studio.

And project structure with Xamarin traditional looks like this:



  • Shared code project: Code base that is common and reusable for your other projects.
  • Xamarin.Android: Project for your Android app where you are writing code using Android specific APIs, writing your UI code, etc.
  • Xamarin.iOS: Project for your iOS app where you are writing code using iOS specific APIs, writing your UI code, etc.
More info about Xamarin traditional here.


Now about Xamarin.Forms, best definition is quote from Xamarin website:

Xamarin.Forms is a framework that allows developers to rapidly create cross platform user interfaces. It provides it's own abstraction for the user interface that will be rendered using native controls on iOS, Android, Windows, or Windows Phone. This means that applications can share a large portion of their user interface code and still retain the native look and feel of the target platform.

As you can conclude from text above, Xamarin.Forms is a framework that allow you to write your UI using C# or with XAML with opportunity to use MVVM... With Xamarin.Forms you can write your code base and your UI which will be shared across the platforms.

Note: this is a very simple project structure, of course you can add more project for different layers


  • Shared code project: Holds your common code base and also because you are using Xamarin.Forms you can write code for your UI
  • Xamarin.iOS and Xamarin.Android: Code for that specific platform, and some advanced topics such as Custom renderers and Dependency services.


Of course there is some of the limitation if you are using Xamarin.Forms for example out of the box you can only use UI controls that are common across the all platforms. You can read my blog post about Xamarin.Forms pros and cons here.

I hope that this answer is not confusing for you and as conclusion in one or two sentences... Using Xamarin Traditional you can share your code logic between platform specific projects, and with using Xamarin.Forms you can share code logic and also code for UI across your projects.

Note: For shared project and code sharing strategy you can use "Shared Project" and "PCL" this is topic another question so in this answer I was simplifying this and use shared project term for that type of project in Xamarin app solution.

------ END OF THE ANSWER

Ok, guys that was my answer for that question on stackoverflow, again if you find this blog post correct and helpful for you up vote my answer so it can be more recognizable in community.

Hope that this was helpful for you and that you learned something new.

Best regards! Almir Vuk 

You Might Also Like

0 comments