I've been 2 years with Xamarin Environment and mostly I used Xamarin.Forms. But yet, I have no idea what Xamarin Cross Platform is? Can anyone provide some structural differences?
Generally, the main distinction between the two platforms is that Xamarin. Forms allows reusing the same UI code for multiple OS, whereas Xamarin Native is adapted to APIs, specific to a specific platform – Windows, iOS, Android.
Xamarin is one of the most popular cross-platform app development tools for iOS, Android, tvOS, watchOS, macOS, and Microsoft (UWP apps) using C # and . NET. In 2019–2020, it was ranked among the five most popular cross-platform mobile frameworks used by software developers worldwide.
Xamarin. Forms lets you build native apps using a . NET cross-platform UI toolkit that targets the mobile, tablet, and desktop form factors on Android, iOS, and more.
Cross-platform Xamarin is part of the vibrant . NET ecosystem, used by millions of developers worldwide. Share more than 75% of your code across platforms, for "write once, run anywhere" ease. Use your favorite frameworks, tools, and Xamarin's powerful libraries to access native APIs and 2D graphics from shared code.
When we talk about Xamarin there are two approaches in development of native apps:
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 the image below 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 an opportunity to share up to 75% of the codebase as you can see on the image bellow and from a quote from Xamarin.
Using Xamarin Traditional approach you can use a C# as a 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 the 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:
More info about Xamarin traditional here.
Now about Xamarin.Forms, the best definition is quoted from the 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 the text above, Xamarin.Forms is a framework that allows you to write your UI using C# or with XAML with the opportunity to use MVVM... With Xamarin.Forms you can write your codebase 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
Of course, there is some of the limitations if you are using Xamarin.Forms for example out of the box you can only use UI controls that are common across all platforms. You can read my blog post about Xamarin.Forms pros and cons here.
More info about Xamarin.Forms here.
I hope that this answer is not confusing for you and as a conclusion in one or two sentences... Using Xamarin Traditional you can share your code logic between platform-specific projects, and 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 a topic for another question... so in this answer, I was simplifying this and use shared project term for that type of project in Xamarin app solution.
UPDATE, Summer of 2020:
.NET Maui is announced in May of 2020, the question about the difference between MAUI and Xamarin.Forms could be found in the StackOverflow thread here: What is MAUI? and what are differences between MAUI and Xamarin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With