DEV Community

BPB Online
BPB Online

Posted on

Understanding Xamarin and Xamarin.Forms

Xamarin is a development technology that makes it possible for developers skilled in C# and the Microsoft stack to build applications for several operating systems.

More specifically, Xamarin groups the following development platforms:

  • Xamarin.Android, a set of .NET libraries and tools that allow you to run C# code on Android devices. This is possible because Xamarin.Android translates, behind the scenes, all the work done in C# into the Java equivalentand invokes the proper Java and Google tools to create theapplication binaries. As an implication, Xamarin. Android requires the Java Software Development Kit (SDK) and tools like the Android SDK Manager and the Android Device Manager. 

  • Xamarin.iOS, a set of .NET libraries and tools that allow you to run C# code on iPhone and iPad devices. Behind the scenes, Xamarin.iOS translates all the work done in C# into the Objective C equivalent and invokes the Apple developer tools to create the application binaries. 

  • Xamarin.Mac, a set of .NET libraries and tools that allow you to run C# code on macOS machines, building desktop applications. Like Xamarin.iOS, it translates all the work done into the Objective C equivalent and invokes the Apple developer tools to create the application binaries.

  • Xamarin.Forms, one library that makes it possible to target multiple platforms from a single, shared codebase. Behind the scenes, Xamarin. Forms invokes both Xamarin.Android and

  • Xamarin.iOS, and then these twoplatforms do the job of invoking the appropriate native tools to create the application binaries.

Xamarin.Android and Xamarin.iOS make it possible to access the native API of the operating systems they target, whereas Xamarin.Forms needs to pass through them. This is also why you will often hear developers talk about Xamarin native when referring to Xamarin.Android and Xamarin.iOS.

Advantages of Xamarin.Forms
Xamarin native platforms require you to know the operating systems' API in detail. Moreover, you will still need two different projects: one for Android and one for iOS. You will be able to share some logic between the two, but all the user interface and access to the device features need separate work and effort. 

With Xamarin.Forms, you have the following advantages instead:

  • You do not really need to know the native API in detail (though always recommended) because you have code that is common to all the platforms.
  • You can target multiple platforms from one codebase.
  • Xamarin.Forms can also target the Universal Windows Platform from the same codebase, allowing you to make your code run on Windows 10 as well.
  • You write, debug, and maintain code once, not twice, with a reduced effort.
  • You will still publish two different applications, but this is also what you would do with Xamarin.Android and Xamarin.iOS. 

Hope this was helpful.

Top comments (0)