Create Native iOS and Android Apps Using Only C# in Visual Studio 2015

Visual Studio 2015 Screenshot for Adding iOS project.
Visual Studio 2015 gives developers cross platform development tools to create native iOS and Android Apps using C#.

Good news for .NET developers looking to add native iOS and Android App development to their programming repertoire.  The learning curve just got a whole lot easier thanks to some enhancements coming in Visual Studio 2015 (schedule to be released later this month).

The 2015 version fully embraces cross platform development including building native Apps with your C# and .NET framework skills and even sharing most of your code between them.

To achieve this, Microsoft extended its .NET framework with Xamarin – a tool that allows developers to add Android and iOS projects to their solutions. So now, any native App programming that previously required Objective-C or Java, now can be done in C#.  Xamarin even supports Objective-C and Java intellisense to help you browse native objects specific to those devices.

Visual Studio Demo Using Xamarin apps

How it Works

After Xamarin is installed you will be able to add Android, iOS and Windows phone references directly to your C# code base. The single User Interface allows you to add buttons, labels, layouts and other common control elements and these controls will be shared to your backend code to get a fully native Android or iOS app built with shared C# code.

The example below uses Xamarin.Forms which at runtime will be properly mapped to the platform-specific user interface element. Specifically the entry would become a Textbox on Windows; an EditText on Android; and a UITextView on iOS.

using Xamarin.Forms;

var ExampleUserPage = new ContentPage {
    Title = "User Information",
    Icon = "MyUserIcon.png",
    Content = new StackLayout {
        Spacing = 10, Padding = 10,
        VerticalOptions = LayoutOptions.Center,
        Children = {
            new Entry { Placeholder = "MyUsername" },
            new Entry { Placeholder = "MyPassword", IsPassword = true },
            new Button {
                Text = "Please Login",
                TextColor = Color.Black,
                BackgroundColor = Color.FromHex("171717") }}}
};

var ExampleSettings = new ContentPage {
    Title = "My Settings",
    Icon = "MyIcon.png",
    (...)
};

var ShowLoginPage = new TabbedPage { Children = { ExampleUserPage, ExampleSettings } };

Pricing

Unfortunately there are additional costs to use Xamarin in Visual Studio 2015. Pricing is on a per developer basis and ranges from $25 per month for an individual to $158 for the enterprise level package for an organization

Additional Resources

Xamarin Apps in Visual Studio

Strategies for Developing Cross-Platform Applications with Visual Studio 2015