Using Xamarin.Forms, .NET developers can create mobile apps user interfaces faster. This is done by extending the Xamarin framework with a shared abstraction of the common UI objects of each platform. In this article, I will share more about how Xamarin.Forms work and whether or not this can benefit you with your cross-platform efforts.
What is Xamarin.Forms?
Reports show that mobile apps are projected to hit $581.9 billion in revenue in 2020. (Statista) and this number is still growing. This shows the importance of mobile applications, especially to a business with an online presence. Having a mobile application is a necessity.
If you have skills with C# or F#, Xamarin will work best for you. Xamarin allows you to create an abstraction layer using the native platform and helps you develop the app in a more common language. While not as robust, it isn’t that bad as you are able to develop a common language. So where does Xamarin.Forms come in?
Using the .NET framework, you can create applications across several platforms with Xamarin. You can do the development using Windows or Apple (iOS) operating systems. Everything is accomplished through the Mono framework and allows you to share a common library.
When developing the Xamarin project using the iOS platform, you will first need to create a Visual Studio project. With iOS, you start with an application logic within the project, creating interaction and using the MVC design pattern. All this using the .NET Framework. You can also take this one step further through a shared library project. Using the Windows operating system, you will be creating a .NET project by selecting the Xamarin platform.
What is Xamarin.Forms?
With each project, Xamarin.Forms create an abstraction that provides a common API and allows your shared project to reference native UI objects. Because the shared library can interact and create with the presentation layer, you can then move the user interface into the shared library. Application flow and business logic have been moved to the shared library too, which means that communication with the device has been lost as the platform’s application logic no longer drives the application. Communication through a proxy is needed since the shared logic is not able to communicate with the device features. The image below shows how the library is being shared by both Android and iOS.
Xamarin.Essentials — a library, works well with Xamarin.Forms. It’s a NuGet package that also creates abstraction and allows you to communicate features with the common API. This is a good picture – however, you may need platform-specific logic developed still. Don’t worry though as Xamarin is extremely flexible. A Xamarin.Forms application declares the user interface in one or more XAML files. Here we see a very basic XAML file. Xamarin.Forms can be built up and referenced programmatically, but for now, let’s focus on the XAML declarations.
Although Xamarin.Forms and Xamarin.Essentials can be used independently, they also work well together. With Xamarin.Forms, you can get started with developing your own mobile applications. With Xamarin.Forms, you can jump right into the development of your application. If you are interested in a deeper dive into the full Xamarin ecosystem, please contact our team at Agile Tech. We have done many Xamarin applications for our clients. Below are a couple of sample screenshots of our work.