How does Xamarin help mobile development?





Who is Xamarin for?

Xamarin is for developers with the following goals:

Share code, test and business logic across platforms.
Write cross-platform applications in C# using Visual Studio.



The diagram shows the overall architecture of a cross-platform Xamarin. Xamarin allows you to build native user interfaces on each platform and write business logic in C# that is shared across platforms. In most cases, 80% of an application's code can be shared using Xamarin.

Xamarin is built on top of .NET, which automatically handles tasks like memory allocation, garbage collection, and interoperability with underlying platforms.

For more information on platform-specific architecture, see Xamarin.Android and Xamarin.iOS.

Added features
Xamarin combines the capabilities of native platforms and adds features that include:

Complete Binding for Core SDKs - Xamarin includes bindings for almost the entire core SDK platform in both iOS and Android. 

In addition, these bindings are strongly typed, meaning they are easy to navigate and use, and provide robust type checking at compile time and during development. Strongly written bindings lead to fewer runtime errors and better quality applications.


Objective-C, Java, C, and C++ Interop - Xamarin provides facilities for directly invoking Objective-C, Java, C, and C++ libraries, giving you the ability to use a wide variety of third-party code. 


This feature allows you to use existing iOS and Android libraries written in Objective-C, Java, or C/C++. Additionally, Xamarin offers binding projects that allow you to bind native Objective-C and Java libraries using declarative syntax.


Modern Language Constructs – Xamarin apps are written in C#, a modern language that includes significant improvements over Objective-C and Java, such as dynamic language properties, functional constructs like lambdas, LINQ, parallel programming, generics, and more.


Robust Base Class Library (BCL) – Xamarin applications use the .NET BCL, a large collection of classes that have comprehensive and efficient features such as powerful XML, database, serialization, IO, string and networking support, and more. Existing C# code can be compiled for use in an application, providing access to thousands of libraries that add functionality beyond BCL.


Modern Integrated Development Environment (IDE) – Xamarin uses Visual Studio, a modern IDE that includes features such as code auto-completion, a sophisticated project and solution management system, a comprehensive library of project templates, integrated resource control, and more.


Mobile Cross-Platform Support – Xamarin offers sophisticated cross-platform support for the three major platforms iOS, Android, and Windows. Applications can be written to share up to 90% of their code, and Xamarin.Essentials offers a unified API to access common resources across all three platforms. 

Shared code can significantly reduce both development costs and time to market for mobile developers.


Xamarin.iOS


 


Xamarin.iOS apps are fully AOT-Ahead-of-Time compiled from C# to native ARM build code. Xamarin uses selectors to expose Objective-C to managed C# and registrars to expose managed C# code to Objective-C. Collectively, selectors and registers are called "bindings" and allow Objective-C and C# to communicate.


Xamarin.Android


 


Xamarin.Android applications are compiled from C# to Intermediate Language (IL), which is then Just-in-Time (JIT) compiled into a native assembly when the application is launched. Xamarin.Android applications run in the Mono runtime, side-by-side with the Android Runtime (ART) virtual machine. Xamarin provides .NET bindings to the Android.* and Java.* namespaces. The Mono runtime calls these namespaces through Managed Callable Wrappers (MCW) and provides Android Callable Wrappers (ACW) for ART, allowing both environments to call code inside each other.   
 

Previous Post Next Post