Xamarin is Microsoft owned with a C#-shared code base. You can build native apps for multiple platforms on a shared C# code base. Use the same IDE, language, and APIs everywhere. Anything which you can do in swift, objective c or java that you can do in C# with Xamarin.
In xamarin business logic is shared among all the platforms, but UI layer is specific to each platform means you have to design separate UI for individual platforms.
The Xamarin platform consists of a number of elements that allow you to develop applications for iOS and Android:
- C# language – Allows you to use a familiar syntax and sophisticated features like Generics, Linq and the Parallel Task Library.
- Mono .NET framework – Provides a cross-platform implementation of the extensive features in Microsoft’s .NET framework.
- Compiler – Depending on the platform, produces a native app (eg. iOS) or an integrated .NET application and runtime (eg. Android). The compiler also performs many optimizations for mobile deployment such as linking away un-used code.
- IDE tools – The Xamarin Studio IDE and the Xamarin plug-in for Visual Studio allow you to create, build and deploy Xamarin projects.
- In addition, because the underlying language is C# with the .NET framework, projects can be structured to share code that can also be deployed to Windows Phone.
- No additional downloads and installations are required in android and windows phone case.
The C# source makes its way into a native app in very different ways on each platform:
- iOS – C# is ahead-of-time (AOT) compiled to ARM assembly language. The .NET framework is included, with unused classes being stripped out during linking to reduce the application size.
- Android – C# is compiled to IL and packaged with MonoVM + JIT’ing. Unused classes in the framework are stripped out during linking. The application runs side-by-side with Java/ART (Android runtime) and interacts with the native types via JNI.
- Windows – C# is compiled to IL and executed by the built-in runtime, and does not require Xamarin tools. Designing Windows applications following Xamarin’s guidance makes it simpler to re-use the code on iOS and Android.
- Note that the Universal Windows Platform also has a .NET Native option which behaves similarly to Xamarin.iOS’ AOT compilation.
- A key benefit of using Xamarin to build cross platform applications is that they can take advantage of native UI toolkits to present a familiar interface to the user. The UI will also perform as fast as any other native application.
- Advance featured language: C#
- Strong IDE: Microsoft Visual studio
- Native app
- Easy maintenance
- Minimum development resource
- Xamarin Test Cloud – automation to run test suite on thousands of devices.
- Distribute beta versions, collect live crash reports, get feedback from real users and analyze test coverage.
- Ship better apps faster with automated testing.Integrates with CI for continuous automated testing, testing apps on every change.
Demo App : Weather Forecast Zip Code / City wise
In this application we used Xamarin for development to create native app for all mobile platforms like iOS, android and windows.
This is the system in which you can get weather information for particular area through pincode. In this application user have to enter zipcode of his area and click on submit button after clicking we have used a third party Web API which is giving us real time weather data for each zipcode (city).
- C# Language
- Web API
When Xamarin applications are compiled, the result is an Application Package, either an .app file in iOS, or .apk file in Android. These files are indistinguishable from application packages built with the platform’s default IDEs and are deploy-able in the exact same way.
Following are the screenshots of android, windows and iPhone respectively.
Xamarin is the best tool to develop mobile app in following cases:
- If it is necessary to develop app for all platforms.
- It is an advantage for large/enterprise mobile app, which would have complex business logic.
- Less number of resources.
- Companies using xamrine for full time development of apps : inwizards, mobiloitte.com, Honeywell, 3DPLM