Xamarin is a cross-platform application development framework. It allows you to develop a mobile app using C# and reuse most of the codebase across multiple platforms including Android, iOS and Windows. Among the advantages of Xamarin are native user interfaces, native API access, native performance and developer productivity.
Who created Xamarin?
Xamarin has its roots in Ximian and Mono projects, and developed by the co-founders of Xamarin, Miguel de Icaza and Nat Friedman (who is presently the CEO of Github). In 2016, Microsoft acquired the company and continues development of Xamarin.
What is Xamarin?
Xamarin is a cross-platform app development framework available as part of Visual Studio IDE and enables developers to build mobile apps for multiple platforms like Android, iOS and Windows Phone using C#.
Where can I learn more about Xamarin? When should I use Xamarin?
As a note, Xamarin should not be confused with .NET Core, though both are cross platform and open source. Xamarin is for cross-platform mobile (though it can be used for MacOS) whereas .NET Core is for creating cross-platform web apps, microservices, libraries and console apps that can run on Windows, Linus or MacOS.
Why should I use Xamarin?
Xamarin helps to expedite native mobile app development targeting multiple platforms. It's been said that for informational apps, 85% of code can be reused across Android and iOS. For more intensive apps, code reuse of 50% is possible. This code reuse comes from using shared C# app logic across platforms.
For developers, this means that you get to build native Android, iOS and Windows Phone apps concurrently without having to build them one after another or having multiple teams with multiple skillsets and tools.
Xamarin.Android and Xamarin.iOS provide further customization possibilities for developers who are looking at tweaking the app's look and feel achieved with Xamarin.Forms. There are several other benefits like seamless API integration, easy collaboration and sharing, etc.
How much does it cost to use Xamarin?
Xamarin was initially available for a license, but after it was acquired by Microsoft in 2016, it is now bundled with the Visual Studio suite of tools for free. While Visual Studio is not completely free, there is a Community Edition, which is free for eligible companies and developers.
What are the pre-requisites for Xamarin app development?
To develop the app, one should have good programming expertise in C#, assuming that the RESTful APIs required for the application are already available. A Windows PC will be required for development on Android and Windows platforms. iOS development is done on Windows PC but to build the app, a Mac will be required to be connected in the same network as per Apple's requirements.
How does Xamarin compare against other cross-platform frameworks?
For development, Xamarin lacks automatic restarting and hot/cold swapping. In this aspect, React Native is one of the easiest for developer productivity. All frameworks allow native code bindings but this process is easiest on Xamarin. Xamarin offers full one-to-one bindings to native libraries whereas in React Native or Ionic, support is partial and done via an abstraction layer.
A blog post from AltexSoft compares the performance of Xamarin apps against native apps. It concludes that performance drop due to Xamarin is acceptable for most cases but the use of Xamarin.Forms is not recommended when apps are CPU intensive.
What are some criticisms of Xamarin?
It's been said that Xamarin support for latest platform updates (iOS/Android) are usually delayed. While iOS and Android developers can tap into an active ecosystem plus use open source technologies, similar following is limited in Xamarin. Xamarin is also not suited for apps that are heavy for graphics, where code reuse will be limited. For that matter, Xamarin developers still need to learn platform-specific languages for the UI, unless they also adopt Xamarin.Forms for their apps.
Xamarin apps are also larger in size when compared to equivalent native apps. This is because the app has to include the Mono runtime and associated components. A simple "hello world" Android app written in Xamarin requires about 16 MB.
Could you describe some useful Xamarin-relevant terms that developers should know?
The term managed code refers to code that's managed by .NET Framework Common Language Runtime. In the case of Xamarin, this is the Mono Runtime. In contrast, native code is code that runs natively on the platform. Managed code could be in C# or F#. Java/Android code are native to Android; or Objective-C code is native to iOS/MAC.
During compilation, C# or F# code is converted to Microsoft Intermediate Language (MSIL). In Android and Mac platforms, MSIL is compiled to native at runtime using just-in-time (JIT) compilation. In iOS, due to security restrictions, this is not allowed. Hence ahead-of-time (AOT) compilation is performed.
What's the architecture of Xamarin?
Architecture is described in the documentation in three places:
In general, C# code and .NET APIs sit on top of Mono runtime, which in turn sits on top of the OS kernel. Architecture allows for managed code to invoke native APIs via bindings. In Android, Managed Callable Wrappers (MCW) are used when managed code needs to invoke Android code; Android Callable Wrappers (ACW) are used when Android runtime needs to invoke managed code. There's also the Java Native Interface (JNI) for one-off use of unbound Java types and members.
- AltexSoft. 2017. "Performance Comparison: Xamarin.Forms, Xamarin.iOS, Xamarin.Android vs Android and iOS Native Applications." AltexSoft Blog, August 22. Accessed 2018-08-21.
- AltexSoft. 2018. "The Good and The Bad of Xamarin Mobile Development." AltexSoft Blog, May 08. Accessed 2018-08-21.
- Cogan, Adam. 2015. "Getting 96% Code Reuse with Xamarin Forms." January 14. Accessed 2018-08-21.
- Cruxlab. 2017. "Xamarin vs Ionic vs React Native: differences under the hood." Medium, September 20. Accessed 2018-08-21.
- Guthrie, Scott. 2016. "Microsoft to acquire Xamarin and empower more developers to build apps on any device." Official Microsoft Blog, February 24. Accessed 2018-06-24.
- Microsoft Docs. 2017a. "Xamarin.Mac architecture." Advanced Concepts and Internals, Xamarin.Mac, April 12. Accessed 2018-08-21.
- Microsoft Docs. 2017b. "iOS App Architecture." API Design, Xamarin.iOS, March 21. Accessed 2018-08-21.
- Microsoft Docs. 2018a. "Architecture." Advanced Concepts and Internals, Xamarin.Android, April 25. Accessed 2018-08-21.
- Microsoft Docs. 2018b. "Working With JNI." Java Integration, Xamarin.Android, March 09. Accessed 2018-08-21.
- Mono Project. 2005. "Mailpost:earlystory." Archived from October 2003, November 03. Accessed 2018-08-21.
- Mono Project Docs. 2018. "About Mono." June 20. Accessed 2018-08-21.
- Montemagno, James. 2015. "Code reuse using Xamarin of 50-85% gets Apps faster to market." Interview, Blog, StreetHawk, April 15. Accessed 2018-08-21.
- Perception System. 2017. "9 Reasons to choose Xamarin for Mobile App development." Accessed 2018-06-24.
- Strikingly. 2018. "The Legends of .NET." Accessed 2018-08-21.
- Xamarin. 2017. "Intro to Xamarin for Visual Studio: Native iOS, Android, and Windows Apps in C#." YouTube, March 2. Accessed 2018-06-24.
- Zia, Danyal. 2017. "Ionic 2 vs ReactNative vs NativeScript." Blog, DiscoverSDK, February 02. Accessed 2018-08-21.
- de Icaza, Miguel. 2011. "Announcing Xamarin." Blog, May 16. Accessed 2018-06-12.
- de la Torre, Cesar. 2016. ".NET Core, .NET Framework, Xamarin – The WHAT and WHEN to use it." Microsoft MSDN Blog, June 27. Accessed 2018-08-21.
- Types of Mobile Apps
- C# (Language)
- Android App Development
- iOS App Development
- Official Xamarin website
- Xamarin Documentation
- The Xamarin Show
- Microsoft Virtual Academy - Xamarin courses
- Xamarin University
- Pluralsight - Beginning Mobile Development with Xamarin