Xamarin is an awesome platform for creating Cross-Platform Mobile application, and as a C# developer it just feels simple and easy to use.
While developing a Mobile application in Xamarin one can approach it in two ways.
- The traditional way where we can create platform specific projects for iOS (Xamarin.iOS) and Android (Xamarin.Android) , we can still share code or business logic between them using Portable Class Library (PCL) or Shared Projects.
- Or, use Xamarin.Forms
So what is Xamarin Forms?
Xamarin.Forms is a cross-platform UI toolkit that allows developers to easily create native user interface layouts that can be shared across Android, iOS, and Windows Phone
Does this mean, can I use Xamarin.Forms for all kind of Mobile projects? Well the Answer is No. Xamarin.Forms works on a subset of all the common native UI controls available across all platforms like Text box, List View, Image, etc. Though, Xamarin.Forms are extensible and can be used to implement platform specific components too.
When to use Xamarin Forms?
It clearly depends what kind of an App you are building. If the focus of the App is on UI, then Xamarin.Forms might not the best of Answers. But if your focus is on Code sharing then Xamarin.Forms is the Answer.
Xamarin.Forms is best suited for Apps which focus on showcasing data. With Xamarin Forms one can achieve upto 96% of code sharing.
The Design Language
Xamarin.Forms brings back XAML (Extensible Application Markup Language) the Microsoft design language used in Silverlight, WPF and WindowsPhone. And with XAML we get the power of the MVVM (Model-View-ViewModel)
Yes, it is. Once you wrap your hands around writing XAML it is. This is how much XAML is required to designing a login page.
<?xml version="1.0" encoding="utf-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Login" x:Class="Login.MainPage"> <StackLayout Spacing="20" Padding="20" VerticalOptions="Center"> <Entry Placeholder="Username"/> <Entry Placeholder="Password" IsPassword="true"/> <Button Text="Login" TextColor="White" BackgroundColor="#77D065"/> </StackLayout> </ContentPage>
And it can run in all platforms.
And it is all NATIVE !!!
In summary, if you are looking a creating Apps quickly that need to run in all Mobile platforms than Xamarin.Forms is the way to go.