Xamarin Guidance

Founder and thought leader Dan Hermes, Xamarin MVP, Microsoft Regional Director and MVP, and author of two Apress books on Xamarin, offers guidance to developers and business leaders at user groups, workshops, and conferences.

Lexicon Systems provides world-class Xamarin guidance, training, and development for your cross-platform mobile projects.

We answer your Xamarin questions and help you and your teams solve problems that stand between you and successful sprints.

● About Xamarin

● Why Xamarin?

● Developing with Xamarin

● Managing a Xamarin Project

● What is Xamarin.Forms?

What Is Xamarin?

Xamarin is a development platform that allows us to code native, cross-platform iOS, Android, and Windows Phone apps using C#.

How does it do that? Using wrapped native APIs. Descended from the open source Mono Project that brought .NET to Linux, the Xamarin platform is a port of .NET to the iOS, Android, Windows, MacOS, and other operating systems. Underlying Xamarin.Android is Mono for Android, and beneath Xamarin.iOS is MonoTouch. These are C# bindings to the native Android and iOS APIs for development on mobile and tablet devices.

This gives us the power of the Android and iOS user interface, notifications, graphics, animation, and phone features such as location and camera—all using C#.

Each new release of the Android and iOS operating systems are matched by a new Xamarin release that includes bindings to their new APIs. Xamarin’s port of .NET includes features such as data types, generics, garbage collection, Language-Integrated Query (LINQ), asynchronous programming patterns, delegates, and a subset of Windows Communication Foundation (WCF).

Libraries are managed with a linker to include only the referenced components. Xamarin.Forms is a layer on top of the other UI bindings which provides a fully cross-platform UI library.

Why Xamarin?

With the battle continuing to rage between mobile operating systems, it is no longer enough to just get a mobile app up and working on a single platform. We must think cross-platform from the get-go.

Within the world of .NET, Xamarin provided us with the tools to make cross-platform development the norm. Business logic, data access layer, and, using Xamarin.Forms, even the UI are mostly platform-independent.

So whether you are building an Android, iOS , Windows, or even a MacOS app, the approach can be largely the same for many components of the app. This shortens the development time for multiple platforms and lowers the overall cost of ownership of your apps. Plus Xamarin is awesome, so there’s that.

Why? Because all of this produces a native app with native controls running the native SDK. These are real apps, all the way down to the metal.

Developing with Xamarin

The most exciting/terrifying part of mobile development is learning the ins and outs of several operating systems. Lucky for us, Xamarin shields us from many of the details, wrapping platform-specific APIs and exposing familiar .NET using C#. Conversely, exposed to us in detail are C#-wrapped user interface (UI) APIs for each platform, giving us precise control over the visual design of our app. The trick is to understand which aspects of each operating system are important during development and which can be left up to Xamarin.

These are the key questions:

● How do we approach the development of a cross-platform mobile application?

● Given the history and background that we already have in C# development, how do we carry forward this knowledge and leverage it in the mobile space?

● Finally, given the multitude of things to learn about these operating systems, what do we need to get started and help solve the important challenges?

When writing apps for more than one platform, a key goal is the reuse of code. The more we reuse, the quicker and cheaper our projects become, and the more we lower our maintenance costs. Xamarin refers to this as the unicorn of mobile development: write once, deploy anywhere.

Any quest for a unicorn begins with a fair maiden to entice it to appear. Our fair maiden is cross-platform design.

Managing a Xamarin Project

Plenty of Xamarin projects are run using agile Scrum and the structure of the work isn’t much different from other types of projects like web apps. What’s new is that the cross-platform architectural elements lead to specific choices in how the developers should work.

 

Specifically, different platform apps can be built in parallel, such as iOS and Android, but at a cost of making many of the same mistakes twice.

Many successful projects begin with one platform and deliver it, then move onto another.The question of serial vs. parallel comes up again in the building of the data layer and back-end services in relationship to the front-end mobile UI.

Some projects start from the back, and others (generally the more agile ones) approach each story as a cross-cutting task where back end, data layer, and UI and all built out at once.

There’s no right way to do these things, and the decisions and challenges are similar to plain-old multi-tier development, but each approach has a pro and a con.

We’re glad to discuss those with you.

What is Xamarin.Forms?

The first question most of our new clients ask is: Should we go with Xamarin.Forms? This leads to an explanation of what Xamarin.Forms is and what it is not.

Xamarin.Forms is a fully cross-platform library providing a single set of UI controls, layouts, and pages that map cleverly in the background to respective native UI bindings on iOS, Android, Windows, MacOS, and others. Xamarin.Forms provides a cross-platform toolkit of pages, layouts, and controls and is a great place to start to begin building an app quickly. There are two ways to create user interfaces in Xamarin.Forms, either in C# using the rich Xamarin.Forms API or using Extensible Markup Language(XAML), a declarative markup language created by Microsoft used to define user interfaces. Xamarin.Forms elements are built using Page, Layout, and View classes. This API provides a broad range of built-in cross-platform mobile UI patterns.

Xamarin.Forms comprises platform-independent classes that are bound to their native platform-specific counterparts. This means we can develop basic, native UIs for all three platforms with almost no knowledge of iOS and Android UIs. Rejoice but beware! Purists warn that trying to build apps for these platforms without an understanding of the native APIs is a reckless undertaking.

Let’s heed the spirit of their concerns. We must take a keen interest in Android and iOS platforms, their evolution, features, idiosyncrasies, and releases. We can also wallow in the convenience and genius of the amazing cross-platform abstraction that is Xamarin.Forms.

The first question most of our new clients ask is: Should we go with Xamarin.Forms? This leads to an explanation of what Xamarin.Forms is and what it is not.

Xamarin.Forms is a fully cross-platform library providing a single set of UI controls, layouts, and pages that map cleverly in the background to respective native UI bindings on iOS, Android, Windows, MacOS, and others. Xamarin.Forms provides a cross-platform toolkit of pages, layouts, and controls and is a great place to start to begin building an app quickly. There are two ways to create user interfaces in Xamarin.Forms, either in C# using the rich Xamarin.Forms API or using Extensible Markup Language(XAML), a declarative markup language created by Microsoft used to define user interfaces. Xamarin.Forms elements are built using Page, Layout, and View classes. This API provides a broad range of built-in cross-platform mobile UI patterns.

The Xamarin development team at Microsoft moves quickly. With each new release of Xamarin.Forms, more properties and methods are included in the bindings, bringing this library closer to the platform-specific ones and giving us increased control over our cross-platform UI. Also, open source projects and third-party tools such as Telerik’s UI for Xamarin are swiftly extending the options available with added controls, charts, and data grids.