10 lovely things you should tell your friends about Xamarin ❤

Visual Studio Xamarin WinUI General XAML

5 years ago

This article is part of the Xamarin Month February 2019. Thanks, Luis Matos (@luismatosluna on Twitter) for the cool initiative! Xamarin is a fantastic platform, indeed one of a kind. I was its fan from its humble beginnings and have witnessed its incredible growth. Xamarin matured a lot throughout the years, and it is an excellent choice if you want to build cross-platform apps, don't fancy JavaScript that much and want to maximize code sharing while keeping the performance top notch. This article arms you with talking points to share with friends who don't know Xamarin or don't find it interesting yet. Some are more practical, some less; some facts, some personal favorites and some are here mainly to entertain you a bit. Feel free to add your own tips and opinions in the comments! Now, without further ado - here are 10 lovely things you should tell your friends about Xamarin.

1. Where does the name come from?

Let's start with the basics: Where does actually the name Xamarin originate? The answer can be found in one of the interviews with Miguel de Icaza:

"We've used monkey themes for many years," de Icaza said. "Ximian was a play on simian. Mono is Spanish for monkey. Xamarin comes from the tamarin monkey. And we kept the X, though to tell you the truth, I can't remember why we used it in the first place."

So if you ever wondered, why the mascot of Xamarin is a monkey, here is your answer!

Xamarin monkeys

Xamarin monkeys

2. Xamarin is all C#

For me, this is the biggest plus of Xamarin. C# is a beautiful, readable and clear object-oriented and strongly-typed language which keeps evolving in unexpected ways with each release. Microsoft is really committed to making it the most universally usable programming language and being able to build cross-platform mobile apps with it is just another piece of this puzzle. Xamarin has been designed to take full advantage of C# while providing native performance on all platforms. You can use all C# features including LINQ, async/await, anonymous types and tuples. Besides, the native APIs of the target platforms are adapted to use C#-like conventions so you will intuitively know how to use them. In fact, many of the APIs are improved in the process - some gain a generic version like Android's Activity.FindByViewId<T> method, others offer async/await support like UIKit.AnimateAsync method. Here is a concise overview of reasons why C# is an attractive choice for mobile developers:

C# is a great choice for mobile developers

C# is a great choice for mobile developers

3. Xamarin ❤ open source

As is the standard for the new Microsoft, everything is open source and so is Xamarin. Mono, Xamarin.Android, Xamarin.iOS and Xamarin.Forms source code and docs all are under MIT license and available on GitHub so you can raise issues and contribute anytime. This is great for the platform as the community can help improve the products and suggest new features. Check the open-source section on the official Xamarin website for links to source code, documentation, and related Gitter chats.

Xamarin + Open Source

Xamarin + Open Source

Thanks to the great work of the community you can find a large number of outstanding libraries and toolkits for Xamarin. A hand-picked selection of the most notable ones can be found in Awesome Xamarin repository on GitHub. The list is categorized by type so whether you are looking for an IOC container, MVVM framework, or some advanced UI controls, it has what you need. The best thing about Xamarin being developed out in the open is that everyone can help it evolve and you can rest assured that the team really listens. They are passionate about Xamarin and welcome all your ideas!

4. Xamarin gives you full access to native APIs

From the very start, one of the key advantages of Xamarin was the fact that it does not compromise on access to platform-specific APIs. And is not just a marketing mumbo jumbo, it really is the case! To prove this, I have handpicked a handful of mission-critical APIs in Android SDK and their Xamarin.Android counterpart.

Know thy user

The users of our apps are almost mythical beings - we can't know them while we build our app, but we sure must keep them in mind to anticipate their needs and give them the best user experience. However, at least a basic classification of the user could go a long way and there are Android APIs to do just that. Of course, first, you should definitely check if the user is not actually a goat subject to teleportation. With Xamarin.Android it is super simple:

Of course, when you have ruled out the goat thing, you may still wonder, as the right Xamarian, if the user is a monkey (no offense, it is the Xamarin mascot!). Again, Xamarin.Android is here for the rescue with a one-liner:

Gravity matters

It is all nice to use your phone here on Earth, but what if you are an astronaut roaming the other planets? Xamarin.Android got you covered! The SensorManager class containsall the constants you may need:

And I hear all the Star Wars fans asking - and what about the Death Star? How will users use my app there? No problem, Xamarin.Android got you covered:

Finally, all Lost fans rejoice! Xamarin.Android knows the gravitational pull on The Island too!

As you can see, with Xamarin, you need never worry about missing platform-specific functionality!

5. Xamarin.Forms is growing really fast

Nat Friedman once said Xamarin.Forms was initially been internally called "Duplo" and was intended to build quick and simple line-of-business apps but after it was open-sourced, it evolved into a full-fledged framework capable of crafting not only functional but also beautiful apps. This is happening in large part thanks to the open-source community members who are regularly contributing to the project on GitHub. Because a picture speaks a thousand words, I have used Gourceto generate the following visualization of how the Xamarin.Forms code repository has grown over time. Play it in all its Full HD @ 60 FPS glory, and If you contributed you might catch yourself in the video as well! https://www.youtube.com/watch?v=rgHTh6DF13s

6. You can use your native libraries

Using Xamarin.iOS and Xamarin.Android doesn't limit you to the C# world only - you can use your existing Java and Objective-C libraries in your apps as well. In both cases, you add a Binding Library project to your solution, where you provide the native library - in case of Android in the form of a .jar or .aar and for iOS with .a. Then you generate the C# interface for your library. Android Binding Library will do it automagically for you at build time (even transforming the naming conventions to match C#). iOS Binding Library is not as straightforward, but you can use a command line tool called Objective Sharpie to help you create the proper C# API. When you have your API ready, you can just reference the binding library project in your app and use the it in C#. The full process for native library binding is described in Microsoft Docs here for Android and here for iOS. However, before you go into the trouble of creating binding libraries, definitely check GitHub, as there already is quite a lot of pre-generated binding libraries you can just put into your project and use.

7. You can use .NET code in your native app

Now the other way around - if you have some great .NET code which you would like to use in your native Android or iOS app, you can utilize .NET Embedding. This is based on the open-source Embeddinator-4000 tool which takes your .NET assembly and turns it into a library that can be consumed from Java, Objective C, and C code. This feature is currently in preview, so definitely post any feedback to the project on GitHub.

Embeddinator-4000

Embeddinator-4000 has a cool logo too!

8. Uno + Xamarin = UWP everywhere

If you know me, you probably know I am a fan of Windows and the Universal Windows Platform (UWP). I love XAML and find the UWP API more comfortable to use than Android or iOS APIs. The main disadvantage UWP is the fact it runs on Windows only, which is a platform which (temporarily I hope ?) lacks a mobile device form factor. Many times have I thought how awesome it would be if Microsoft turned UWP into UAP - full-fledged Universal Application Platform, which would run literally everywhere. And then, out of the blue, we got just that with the Uno Platform built by the nventive team. They have been working on it in Montreal and New York for the past four years and open-sourced it in 2018. And it is a big deal.

Uno Architecture

Uno Architecture

Xamarin native allows you to share most business logic of your app across all platforms with .NET Standard libraries, but you still have to implement platform-specific APIs and especially the UI. And this is where Uno shines. Instead of making you build your UI with the tools specific to the target platform, you get the full UWP XAML dialect you are familiar with and used to writing - including Adaptive Triggers for example. This might sound quite like Xamarin.Forms, but as opposed to making the app look like a native app on the given platform Uno defaults to the UWP theming of controls regardless of which OS your app is running on, and the result is a pixel perfect UI that looks the same way no matter the OS you are using. However, thanks to XAML Styles and Templates, you are entirely free to customize the UI to exactly match your liking and brand, without having to resort to platform-specific code. In its core, Uno utilizes Xamarin on Android and iOS and on Windows 10 it runs natively against UWP API. It would be easy to dismiss the project as not being production ready, but in fact, that is what nventive has been using it for - they have already built hundreds of apps for their clients using Uno, and they are published in app stores. https://twitter.com/UnoPlatform/status/1006289164973760512?s=20 Also thanks to the fact that Uno is UWP based, you get full Visual Studio support out of the box and can use tools like the XAML designer, XAML, and C# Edit & Continue and much more. Oh, and have I mentioned Uno runs on WebAssembly too? I am a big fan of the Uno Platform and am planning to contribute to their codebase this year, as I see tremendous potential in it. I hope Microsoft notices it too and helps the team grow it even further.

9. Use MVVM everywhere with MvvmCross

The MvvmCross framework was initially founded by Stuart Lodge and is currently run by Martijn van Dijk, Tomasz Cielecki and over 250 community contributors. I have used this framework almost from the start of my cross-platform development journey, and I can't express how useful it has been to me.

MvvmCross

MvvmCross

MvvmCross primarily targets developers who are building Xamarin apps with native UI layer (although the newer versions have added support for Xamarin.Forms workflows as well). The framework gives you the opportunity to architect the presentation layer using the MVVM design pattern, which originates in XAML. This means you can separate the view (UI) from the view model (presentation logic) and use data-binding and commands to interact with the user. On Windows-based platforms, this works out-of-the-box thanks to XAML and the INotifyPropertyChanged interface. Android and iOS don't use XAML, but MvvmCross provides alternative syntax. For iOS you can set up data-binding in code and in case of Android you can even do it within the Android AXML design file. The functionality is on par with XAML, so it includes the likes of two-way bindings, value converters and more. In addition to the base MVVM functionality, there are a plethora of plugins available ranging from geolocator to picture chooser. Check the official documentation for more details. As a side note, I also recommend diving into the MvvmCross source code on GitHub, because it is exceptionally well designed and structured, so it is a remarkable inspiration if you want to learn best practices of cross-platform API design.

10. There is never enough Xamarin news & events

Another proof of how active the Xamarin community comes from the sheer number of content, which you can read, watch and listen to, and regular events hosted by Xamarin and the community worldwide. I would like to mention at least a few great resources for your inspiration and learning.

Mobile: .NET Community Standup

A fresh addition, which deserves the first place in the list is the official .NET Foundation Mobile: .NET Community Standup. The success of the, now traditional, ASP.NET Community Standup, Microsoft has expanded with two new regular series - Cloud and Mobile. Mobile: .NET Community Standup is lead by three absolutely awesome people - James Montemagno, Maddy Leger and David Ortinau. This dream team will go each month through the best community contributions, great new projects and new features and updates in Xamarin & Visual Studio. This goes hand in hand with great humor, insights and sudden guest appearances by Scott Hanselman. If you want to spend a fun hour each month learning something new, this is your grand choice. The Mobile .NET Community Standup is broadcasted on YouTube and Twitch. You can watch the first episode below and tune in for the next one coming on February 7. Finally - you won't miss any future broadcast if you subscribe directly to the community standup calendar.

Visual Studio Mobile Developer Podcast

The official Xamarin Podcast has been off for a while but was again rebooted in December 2018 with a new name - Visual Studio Mobile Developer Podcast. Hosted by James Montemagno, each episode looks at the most news in the Xamarin world or invites an expert to talk about an interesting concept. Check out the podcast's website for many ways to subscribe on the go.

Visual Studio Mobile Developer Podcast

Visual Studio Mobile Developer Podcast

Gone Mobile

For more general news about mobile development, tune in to the Gone Mobile podcast. Greg Shackles and Jon Dickmention that it still has a healthy bias towards Xamarin technologies, but you will definitely dive into other areas of mobile development as well.

Gone Mobile Podcast

Gone Mobile Podcast

The Xamarin Show

Channel 9 hosts regular episodes of The Xamarin Show, which usually provides a hands-on with a Xamarin or Xamarin.Forms API or showcases useful tips & tricks to improve your dev loop.

Planet Xamarin - Community Blog Feed

If you prefer reading to watching and listening, Planet Xamarin Community Blog Feed got you covered. With more than 100 hundred registered blogs in multiple languages, you can subscribe to see all the newest musings about Xamarin. You can subscribe directly with RSS on this URL.

Xamarin Blog

The official Xamarin Blog is a great way to learn about updates and releases fresh from the oven. You will always get an overview of what is new along with links to comprehensive documentation.

Events

Learning resources online are great, but nothing can replace meeting other like-minded developers and chatting about Xamarin in the real world. For that, we have conferences and meetups, and luckily there is a lot of them all around the world! Perfect source of latest announced Xamarin Events and meetups is the @XamarinEvents Twitter account. Not only because official events are posted here, but also because you can promote your own local meetup via @XamarinEvents as well. A selection of top events is then posted monthly on the official Xamarin Blog.

MonkeyFest

For the last two years, Xamarin hosts a global Xamarin Bootcamp called MonkeyFest. This happens all around the world on the same day full of latest and greatest of Xamarin. This usually takes place in the second half of the year so make sure to check out the website later when the date is announced.

Summary

There is certainly a lot of great cross-platform frameworks and solutions, but I think there nothing quite like Xamarin. It has fantastic support, large and friendly community, great potential for the future and it gave birth to many other cool projects and frameworks. So if your friends are not yet convinced about how awesome Xamarin is, share this article with them, and maybe they will change their mind!