How to build iOS and Android App with Xamarin
Jayavel S.
Director of R&D | Expert in IRS E-File Solutions for Form 2290 & 720 - Technology Leader
Different frameworks and tools for cross-platform mobile development have noticed a massive hype in the industry. Things like Ionic, React Native, Flutter may be the most suitable one.
Mobile Development - Xamarin Approach:
Many of us prefer to make use of the native languages like Kotlin and Java for Android and Swift and Objective C for IOS while considering the mobile development. Xamarin provides a single language library, C#, and runtime of the work across both Android and IOS.
The great thing while considering the documentation of Xamarin is quite detailed and comprehensive, let’s have a summary of everything discussed below.
Code Sharing:
Xamarin offers personnel with the best way to code a shared backend C# for any type of platforms at a single use namely MacOS, IOS, Android, and Universal Windows Platform. Data models, business logic, easy service calls, view models, interaction with SQL Databases are the essential characteristics which are standard to every application, and this can be shared to both iOS and Android platforms. The three crucial options available from Xamarin includes Shared project,.Net Standard Library and Portable class library.
Portable Class Library:
When you create a library project or an application project, the DLL resulting is regulated to function on a particular platform for it is designed for. It helps you to write a Windows app assembly and then make use of them on Xamarin. Android and Xamarin.iOS.
While creating a portable class library, regardless, one can pick a platform combination which you need to run on or code. The choice of compatibility you take while creating a portable class library get translated into the “profile” identifier, this reports what type of platforms will be supported by the library. Some of the benefits includes :
● Operation refactoring affects every solution’s code loaded.
● Supports centralized code sharing, here you will write and test different codes in a project which is consumed by other applications or libraries.
● The portable class library project is referenced easily by any other solutions.
Some of the drawbacks include.
● The subset of the portable class library does not contain classes which would be available otherwise in both Mono and MonoTouch for Android namely System.IO.File or DllImport.
● The same portable class library getting shared with different applications and therefore you will not be able to make the referenced with platform-specific libraries like Community.CsharpSqlite.WP7.
.Net Standard Library:
It is the .NET APIs formal specification which is considered to be available on the .NET runtimes. The standard library is getting established along the .NET Ecosystem with greater uniformity. ECMA 335 sustain to initiate .NET runtime behavior uniformity, but there is no particular specification available for the .NET BCL(Base Class Libraries) for .NET implementations library.
Shared Project:
It is the simplest form, and most of the universal codes are done in the shared project. The three applications get shared with the same source code, and any changes to the code will be occured in the other three projects too.
There is no output in the form of DLL when compared with other types of projects. Regardless, the code gets compiled into each of the projects with references. The shared project code includes compiler directives which will disable or enable code section based on what application project is making use of the code, that is suggested by platform boxes.
For regular updates regarding Xamarin and any other technical side of things, subscribe to our blog. For details contact Jesintha +91 97898 87816 [email protected]