At the time i’m writing this post, there are two popular platforms taking over the market, a two-horse race between iOS and Android. The two mobile operating systems combined for 98.4 percent worldwide market share in the fourth calendar quarter of 2015, compared to 96.4 percent in the year-ago quarter according to research firm Gartner.

For instance, when I want to check my Facebook or twitter account, I personally prefer checking it from their official mobile app rather than navigating to the site, yes believe it or not mobile applications are taking over the web world.

Cool, As a technology enthusiastic or even as a company that would like to promote itself  or a product/service in the market we have to follow this trend, but we have to play it smart, how?

Think about it, if a company would like to build an app for the three platforms: Android, iOS and Windows phone. the company has to hire resources/teams with knowledge of three programming languages: Java for Android, Objective-C or Swift for iOS and C# and XAML for Windows phone. this approach is called Siloed approach

screen-shot-2016-10-09-at-9-49-30-pm

Now following this approach they will end up with the following cons:

  • No code sharing between the three platforms.
  •  High maintenance level, since we have three platforms, resources or programming languages.
  • Expensive 💰💰.

On the other hand, we cannot deny how awesome the app going to look like, it’s because:

  • You get best of class performance wise.
  • Ability to access hardware easily.
  • Native user experience.

Some companies are frustrated by the high cost of this approach, so they follow anther approach which is Web-based app. You can reuse the code across different platforms by writing HTML, CSS and Javascript (could be an excellent idea if you came from web development background).

You can consider the benefits of going with this approach to be:

  • Write code once for all.
  • Saving money $$$.

What are the disadvantages of this approach?

  • Performance isn’t always perfect (Remember we’re running a web app).
  • it’s not always easy to access all native features of the platform.

Two of the most popular web-based frameworks are Cordova and Ionic

The good news! we’ve got 🎉 Xamarin 🎉 which tries to give us the best of the two approaches, Code sharing with C# and you end up getting a native app.

What is Xamarin?

It’s a fantastic tool that has done all the work to allow us to be able to write a mobile application in C# and run it on just about any mobile platform.

  • Native UI, native API access, and native performance
  • Anything you can do in Objective-C, Swift, or Java you can do in C# with Xamarin.
  • Ship cutting-edge apps with same-day support for new OS releases

Meet the Xamarin family

screen-shot-2016-10-09-at-11-14-28-pm

So what’s the difference between Xamarin.iOS, Xamarin.Android and Xamarin.Forms?

Xamarin.iOS and Xamarin.Android as from their names indicate, they’re the UI toolkits for building an app with the help of each platform’s APIs and the Mono .Net framework. if you choose to build an app using these two products you get the benefit of customising UI for each one but there is a trade-off is to have less code sharing.

On the other hand, if you choose to build an app with Xamarin.Forms you will write code only once and this code gets to be translated at runtime to each platform native, the good thing about this is you might get code sharing percentage up to 90%.

I’m confused, which product shall I choose to build my app?

Xamarin.Forms is best for:

  • Apps that require little platform-specific functionality.
  • Apps where code sharing is more important than custom UI. • Developers comfortable with XAML.

Xamarin.iOS & Xamarin.Android are best for:

  • Apps with interactions that require native behaviour.
  • Apps that use many platform-specific APIs.
  • Apps where custom UI is more important than code sharing.

Advantages of Xamarin:

  1. Leverage your .NET and C# knowledge
  2. Native user interface.
  3. Native performance.
  4. Code sharing.

Disadvantages of Xamarin (Xamarin.iOS and Xamarin.Android):

  1. Not a Shared UI platform:
    Following these two products will make you write more customised UI code for each platform but at the same time, you will get the opportunity to share 60% of the code as shown below.
    screen-shot-2016-10-11-at-9-03-32-pm
  2. Hardware requirements:
    If you would you like to run/compile your iOS app using Xamarin studio or visual studio, you must have a mac machine to compile it for you. you can get yourself a mac machine (like me), connect one on the same network that you’re using or you can rent a mac in the cloud such as MacinCloud services.

    You can find the option that suits you well by checking Xamarin.iOS requirement & installation.

  3. Minor learning curve:
    Sure there is a learning curve to know how are you going to deal with Xamarin.Android and Xamarin.iOS APIs, and even how are you going to build UI and so on.

Did someone say anything about IDEs?

Visual Studio:

xamarin2x-yuj5jk33

To get all the benefits such as Team explorer or Resharper using visual studio is the one for you.

 

Xamarin Studio:

ios-designer

If you’re a mac user, you can’t install visual studio on your machine that’s why Xamarin studio comes in hand. Xamarin studio is also available for PC users but personally, I prefer using Visual studio if am running a windows machine.

You can find all the installation instructions by checking this link.
Update (6/1/2017) Visual Studio for mac:

At Connect(); 16 in November, Microsoft is launching a preview of Visual Studio for Mac i couldn’t believe that i can use visual studio on my mac machine without the need for Bootcamp partition on my machine.
But no, after reading this amazing blog post By Mikayla Hutchinson, i realized that visual studio for mac is somehow similar to Xamarin studio but with the ability to build ASP.NET Core apps.

Note they all share the same functionalities such as the drag and drop support and build your interfaces.

Now in my series, I’m going to use Xamarin studio since am a mac user.

Enough talking about theoretical stuff, I like to get my hands dirty with C# code, so let’s get started and build our first Xamarin app. We will have a series of posts each post going to build part of the app till we end up with a good solid app.
Let’s get started 🎉
What are we going to build? (Part 0)

3 thoughts on “Introduction to Xamarin

  1. Very nice post my friend. Keep them coming. I haven’t started with xamarin yet, so I’m eager to start. I’m going to add your blog to my daily readings.

    Like

    1. Glad you liked it mate, soon I’ll post a series of posts on building app from splash screen till deployment.
      Hope they find you well

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s