Getting started with Xamarin

xamarin-logo

“How do I get started with Xamarin?”

I get asked this question a lot lately, thanks to Microsoft’s acquisition of Xamarin. Less than one month after Microsoft announced the Xamarin acquisition at Build 2016, interest in Xamarin went up 3 times.

 

xam increase

Xamarin Evolve 2016 Keynote

This is good for developers who want to play with Xamarin and build their mobile skill set using their .NET competencies, and those who want to switch to cross-platform mobile development from native side. Not to mention, the businesses that were not able to deliver their mobile apps in multiple platforms all at once due to cost and resources. Now they can with lower cost and in a lot of cases, with existing technical resources available, specially if they are a Microsoft shop.

Now is a great time to get introduced to the world of Xamarin. So, after that short intro, I would like to get started on answering the question asked above.

 

Xamarin Platform

There is nothing I can tell you here that is not already published before around the web, but a great place to start, as usual, is on Xamarin’s own website http://www.xamarin.com

To save you some time, here’s what you need to know when it comes to the development environments.

Mac Users

Download Xamarin Studio. It will let you develop for iOS, Android, and Mac. No Windows UWP, Windows Phone compatibility here.

Windows Users

Xamarin Studio has been decommissioned for Windows in favor of world’s best IDE available, Visual Studio. Xamarin now comes with Visual Studio Community and Visual Studio 2015 Update 2 forward. In this configuration, you can develop for iOS*, Android, Windows UWP, Windows Phone, etc. This configuration is used by most enterprise teams. No surprise there.

  • still requires a Mac build host.

For the sake of simplicity, when I say cross-platform, I mean iOS and Android. You can worry about Windows Phone and UWP apps later. This is coming from a guy who has native apps in Windows Marketplace 🙂

 

Xamarin Approach

Xamarin.iOS

Develop native apps for iOS using C#.NET. In a cross-platform app, the platform specific code lives here.

Xamarin.Android

Develop native apps for Android using C#.NET. In a cross-platform app, the platform specific code lives here.

Xamarin.Forms

Develop cross-platform apps using single code-base for UI as well using C#.NET and Xaml.

 

Mobile Development

Now, I believe this is where rubber meets the road. How should you start?

It depends.

You have two options to go about it, the right way, or the other way.

The Right Way…

I am of the opinion that you should start with basic knowledge of native platforms before jumping onto cross-platform train.

Let’s face it, if you don’t familiarize yourself with underlying bits and pieces of native framework, you will spend a whole lot of time and energy on bad workarounds after you’ve already started your first real world app – beyond Hello World!.

I suggest starting with a basic multi-page native app (in Swift for iOS or Java for Android) that has some sort of list view. That will teach you a couple of things,

  1. Native framework (lifecycles, views, controllers, connectors, data, etc.)
  2. How to design the UI
  3. How to manipulate the UI
  4. How to work with some data (getting data, passing data between views, displaying data in a list, etc.)

Once you have completed that exercise in the native worlds (say iOS and Android), you can step into Xamarin world. Now, if and when a customization is required, due to Xamarin’s limitations or bugs (yeah I said bugs), you will have an idea on how to handle it in native code.

Pros:

  • Knowledge of native world (lifecycles, views, controllers, etc)
  • Helps when customizing app (when working with Xamarin.iOS and Xamarin.Android)

Cons:

  • Medium to steep learning curve
  • Prolonged start time for your first cross-platform app, since you will spend time learning native first

But if you are impatient to see your code glory show up on cross-platform devices, you can also go the other way.

The Other Way…

The faster way to get your app up and running on cross-platform devices is Xamarin.Forms. With this approach, you can take your C#.NET and MVVM (or MVC) skills to town and whip up a quick app that has some basic functionality in it without knowing anything about the underlying native code magic.

This approach is well marketed and is very exciting. Lots of new developers and developers with WPF experience are tempted to go for this option and put their skills to test. Nothing wrong with that.

Pros:

  • Low to medium learning curve
  • Quick start on getting your first cross-platform app going

Cons:

  • Xamarin.Forms is still new (at the time this article was written) and not everything works as expected. Also has bugs (hopefully open-sourcing will help expedite the fixes).
  • If/When hit with a Xamarin limitation or bug, requires research and study of native code for workarounds.
  • Using Xamarin.Forms for complex apps will lead to a slew of custom code in the native projects that can become hard to maintain with newer OS versions.

So, pick your preferred option and get developing. Or go parallel 🙂

Xamarin University

Xamarin University

Xamarin University is the best place to learn mobile development using Xamarin. There are several tracks that you can follow depending on your skill level and professional goals. One of the first thing you should try to get done, if possible, is to get certified. The certification lasts 1 year and requires about 17 live online classes and a comprehensive exam at the end. The exam will cover, OOP, iOS, Android, Xaml and other general knowledge in mobile.

 

Summary

In conclusion to my rather long post, take a look at Xamarin for your personal and professional mobile needs. For individuals who want to get into mobile development or have native mobile experience and want to go cross-platform, this is a great option – specially now that it is part of the Visual Studio Community edition. For businesses, It will help reduce the cost by not hiring specialists for each platform you want to go to market with, and will reduce the time to market somewhat.

For a discussion or question, leave a comment below. Enjoy!

 

Some Resources:

Evolve 2016 Sessions (You can see yours truly asking a question in Xamarin.Forms session ;))

Channel9: Getting started video here

Checkout my sample app that is a nice demo of a basic app with Sqlite here

Xamarin’s James Montemagno did a nice intro to Xamarin.Forms here.

Advertisement

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.