When it comes to iOS and Android software development, Objective C vs. Swift and Java are the first programming languages which come to your mind. Being well-known as native tech stacks, they are obviously the most often used mobile development tools. Anyway, there are many different ways to built convenient and user-friendly applications. Let’s review Xamarin and compare it to native and cross-platform mobile development solutions.
What is Xamarin?
Xamarin is a tool used for cross-platform mobile app development that allows engineers to share about 90 percent of code across major platforms. Being a comparatively new tool, it is based on the Microsoft technology stack and already has a community of over 1.4 million developers.
The platform was built by the developers behind Mono, an open-source development platform based on the .NET Framework, and first introduced in 2001. The Xamarin company was founded on May 16, 2011.
For the first time, Xamarin has created as a commercial project, but in 2016 Microsoft has acquired the company. Xamarin became a popular cross-platform product for development community around the Microsoft ecosystem, so the financial barrier for using this tool was broken. As Microsoft made Xamarin SDK open-source, it became part of Xamarin Visual Studio IDE.
The main features
To create applications for all mobile platforms, Xamarin uses a C# as a single language. Xamarin is natively compiled, so it well suited for building native and high-performance apps.
C# is a multi-paradigm language with strong safety-typing that prevents the code from unexpected behavior. C# is one of the .NET framework languages, so it can be used with a number of .NET features such as Lambdas, LINQ, and asynchronous programming.
Speaking in a technical way, Xamarin uses C# and native libraries contained in the .NET layer for cross-platform app development.
These applications can be compared to native for both iOS and Android platforms in case of performance and user experience. More so, Xamarin has the ability to use all native and the latest API access to utilize underlying platform capabilities in Xamarin apps such as ARKit on iOS or Android Multi-Window.
With Xamarin, you can create a platform-specific UI code layer, while the code related to business logic, database access, and network communication can be shared across all platforms. Thus, cross-platform applications built with Xamarin look 100% native on any device, and it is also providing better user experience, as compared to generic hybrid apps.
How is it going with compilation?
Xamarin platform has its two core products related to iOS and Android platforms, so the compilation process is different.
- Xamarin.iOS. The source code is compiled directly into native ARM (Ahead-of-Time compilation) assembly code.
- Xamarin.Android. Android Xamarin applications are first compiled down to Intermediate Language and then — into native assembly code at runtime.
Despite the distinction, both cases the compilation process is automated and adapted to handle issues such as memory allocation, garbage collection, and platform interoperability.
Xamarin project structure
Much of Xamarin-related projects is implied to be run through a Windows development computer with Visual Studio and Xamarin installed. Your app can be debugged straight from the desktop, on devices or emulators. It is also possible to develop iOS apps on Windows, as Visual Studio connects to the iOS storyboard designer and iOS simulator.
Xamarin has been taking the world by storm. In its 7 plus years of existence, it has grown to 1.6 million developers across 120 countries and was acquired by Microsoft to become part of its Visual Studio environment. This makes Xamarin the technology of choice for 15,000 companies in such fields as energy, transport, media, healthcare, and many more. (c) Source