What problem does Xamarin solve?
In the last century mobile applications have become almost inevitable for most of our software solutions today. For almost every service out there, our customers will also have the demand of a mobile app. Now, you could develop an android app, and be done with it. But you would lose a lot of potential customers that dwell on iOS. This would mean a huge financial loss and is unacceptable for most companies. The result are two separate mobile applications: one for Android and one for iOS.
Let’s say, our customer has a team that is used to the Microsoft .NET stack and used ASP.NET applications until now. Sadly, these applications require different programming languages: Java for Android and Swift for iOS. Hiring a completely new team or even teaching these languages to the existing team can be really time consuming and thus expensive. The engineering effort to create and maintain these applications is immense and they can not share any code. When a bug is fixed in one application, this must be done in each of the application projects.
How does Xamarin attempt to solve this problem?
The idea of Xamarin is to develop mobile applications for the various operating systems using only the .NET framework on the developer’s side. They provide the Xamarin.Android framework for Android and the Xamarin.iOS framework for iOS. These frameworks provide a mapping to the device specific controls and functions and makes them accessible in your .NET code. During the build process the compiler will turn these mappings into native code for the specific device. This allows for native performance in comparison with other cross-platform solutions, e.g. Progressive Web Apps or Apache Cordova (aka. PhoneGap).
At this point we still have multiple, separate applications that need to be maintained, but we reduced the technology stack to the .NET Framework. The developers can use either C# or F# to develop these applications inside either Visual Studio, Microsoft infamous IDE, or Xamarin Studio, a specialized IDE for Xamarin development. Not only can these teams use the programming language that they are experienced with, but also the .NET libraries that they are familiar with, e.g. Entity Framework. These will work straight away and handle exactly as on a regular Windows or Linux machine.
Another benefit of using only .NET in your mobile applications is the possibility to share code between them. If they handle similar data or use similar business logic, you can extract them in a shared library and reuse them in all your applications.
You could say that the development process is now a lot easier and the maintenance cost is extremely reduced, and you wouldn’t be wrong about that. The reality is that you still need to maintain different user interfaces for each of the operating systems.
That is where Xamarin.Forms comes into the play: It provides a .NET library with a lot of UI components that can be used inside your projects. These components have bindings to the native components for that specific device. This allows us to develop a single mobile application and compile native applications for each operating system without any extra work. These can be deployed on any device and use the devices layout, e.g. on Android the scroll bar will be rendered differently than on iOS. Using this library your mobile applications might as well reach 100% code-sharing between the different platforms.
What about complex components?
For most applications the Xamarin.Forms library provides enough templates and components to fulfil their needs. If you want or need to have more fine-grained control over your layout and behaviour, it might be unavoidable to use custom implementations using the Xamarin.Android and Xamarin.iOS SDKs. These give you full control of how you want the components to behave on just that specific operating system.
Visual Studio App Center (previously Xamarin Test Cloud)
The mobile device market is so diverse that testing for all kinds of different devices can be tedious and can cost a lot of money when using physical devices. Several emulators are available for virtual testing, but this won’t reveal all the errors that could happen on specific devices.
For this purpose, Xamarin created the Xamarin Test Cloud which was later integrated in the Visual Studio App Center. This allows a team to continuously build, test, release and monitor apps for multiple platforms, including Xamarin. But instead of just executing your tests on emulators you can choose to test your application on thousands of real devices to see how your application behaves under realistic circumstances.
What is the Xamarin Component Store?
Xamarin used to offer a platform where complex components that were already created could be acquired, but it was discontinued in May 15, 2018.
When working with a team that is experienced in the .NET ecosystem and the support of Android or iOS apps is required, Xamarin is the perfect framework for the job. It helps us to fully utilize the existing knowledge and increase maintainability for all applications.