The debate about opting for native development versus using cross platform development tools like PhoneGap, Xamarin, Titanium etc., is a perennial one in mobile app development. As with virtually everything in tech, every option has its own advantages and disadvantages.
In this context, lets take a look at Xamarin, which has been available for a few years now, and acquired by Microsoft last week.
— Satya Nadella (@satyanadella) February 24, 2016
Xamarin has following advantages over other cross platform development services:
• Native UI, native API access, and native performance
• Anything you can do in Objective-C, Swift, or Java you can do in C# with Xamarin
• Ship cutting-edge apps with same-day support for new OS releases
• Integrates with CI for continuous automated testing, testing apps on every change
• Instrument your app to monitor real-world performance and keep your app fast
Fig: Image explaining how the code is written and shared between different platforms. It separates business logic from the user interface. User interface is written for each platform separately. However, Xamarin.Forms can be used to share the User interface across platforms.
Following are some of the pros and cons of Xamarin:
Licensing – Microsoft has now made it open source and is freely available with MS Visual Studio.
Language- C# is used to develop for all the supported platforms.
This language allows for incredibly rapid development and iteration with strong type safety. Cleaner and readable code can be written in C# with features like patterns, generics, LINQ, implicit typing, extension methods, async methods, closures etc.
Shared Code base – Same source code is being used by all platforms (iOS, Android, Windows).
Xamarin can support up to 100% code reuse with use of Xamarin.Forms
Native – Source code is compiled to specific platform. Generally compiled code will be faster compared to Interpreted code. It uses all the native APIs, UI controls and device hardware making the app more performing.
MVVM and MVC – Supports both MVVM and MVC architecture, making it using the advantages the architectures.
Xamarin implementation errors – Even though Xamarin has evolved in years, there could be implementation errors from Xamarin run time. This leads to erroneous behaviour of the app.
3rd party libraries – We may not find the 3rd party open source libraries as in native open source libraries
Mono runtime – Xamarin uses mono runtime to load the to native code in runtime. This adds little performance overhead to the app.
Using Xamarin or native has both advantages and disadvantages. The decision to use Xamarin can be based on these factors:
• Cost of the project
• Availability of C# developers
• Source has more business logic than Presentation UI
It all boils down to individual app requirements and business plans at hand and then decide which suits the project the most.