Mobile, Xamarin

Xamarin Forms – Getting started.

I’ll get straight to the point. This link here has some great tips on learning Xamarin Forms.

David Ortinau is the Xamarin guru. I learned about his involvement with Xamarin by another guru in the St. Louis area named Kevin Grossnicklaus who founded ArchitectNow. When I’m trying to keep up on the latest trends/technologies, Kevin is the primary source that I’ll follow. Kevin is not only specialized in cross platform development in mobile technologies (like Xamarin), but he is also extremely versed in web technologies like Angular(2+)/AngularJS(1), React, ASP.NET/MVC/etc..
Kevin taught at the Xamarin Dev Days back in July 29 of this year. It was an amazing all-day event where we got to develop a cross platform apps that would work on Android, iOS, and as a UWP app. At that event was David Ortinau who provided all kinds of excellent info/feedback.

Xamarin is for real. There’s nothing you can do in Swift or Java for iOS/Android apps that you can’t do in Xamarin. You have all kinds of choices and approaches you can take with Xamarin. You can develop (in C#) against the Android/iOS native API (thru bindings) directly. In iOS, this requires you to understand the native concepts such as storyboards, protocols, navigation controllers, view controllers, etc.. In Android, this requires you to understand the native concepts such as Activities, Intents, etc.. Instead of using Swift or Java, you’d use C# (as it binds directly to the native APIs).

In the above scenario, you are typically sharing your business logic (business objects) and/or classes that would issue REST calls, authentication. Your UI code would be different between the two platforms (and you can use the familiar designer with iOS (similar to XCode)) and one for Android (similar to Android Studio). But it’s all in C# allowing you to leverage your knowledge of the things .NET devs really love about .NET (ie, LinQ, etc..).

An additional scenario called Xamarin Forms started out back in 2013 as MVVMCross. For those who’ve done Silverlight and WPF applications, you will be right at home with Xamarin Forms. I did quite a bit of Silverlight and WPF apps in the past which involved coding the front-end templates in XAML with bindings (1 and 2-way) to the backend C# code. You can also take advantage of .NET’s event propogations (and INotifyPropertyChanged) and a pattern called MVVM (Model View / View Model) which allows the ability to unit test your view models. By using that along with the Command pattern, you end up with XAML templates with property/event binding to your view models and you can perform two-way updates (ie, your model can inform your view of changes and vice-verse).

The beauty of Xamarin Forms, is that you can do all of this within a mobile app which means you would not have to be “as familiar” with how iOS apps do their thing and how Android apps do their thing (from a front end perspective). I’m oversimplifying this and I’m not recommending that you avoid learning the iOS and Android api. From what I understand, the newest release of Xamarin Forms will allow you to mix forms and native screens together (I plan to research that more). The newest release also addresses the multi-rendering performance issue in Android with “fast renderers”.

My take on Xamarin Forms (from the video courses I’ve taken on Udemy/Pluralsight) is that it’s awesome for “forms over data” applications. Although you can do a lot more with it. Being that you can now mix and match forms with native pages (like you would with Xamarin.Android and Xamarin.iOS), this opens up a whole new world by which you can save a ton of development time by sharing your UI code for many screens while still being able to write specific code (pages) for your iOS/Android where it makes sense (ie, graphics intensive screens, etc..).

In one of David Ortinau’s Mobile App Design and Xamarin Forms 3.0 Preview Podcasts (in Xamarin Podcasts), he does mention that developers do “not” allow Xamarin Forms to interfere with having a clear understanding on how to develop your iOS apps to have the iOS experience and your Android apps to have the Android experience. Having said that, you can still customize your forms apps to do specific things depending on the platform you’re running in.

Xamarin Forms has come a long long long way since it’s MVVMCross days back in 2013. It’s ready for prime time!

Mobile, Xamarin

Authentication/Authorization of your Xamarin native app

I highly recommend folks to listen to this Xamarin podcast about identity management in mobile apps. It’s well worth your time if you’re interested in having a mobile app perform its authentication to a “single source of truth”. In this particular case, the “single source of truth” is an Azure AD B2C application that you setup. Once you create your AD B2C app, you can have a native mobile app, a desktop app or a web app utilize identity management in the recommended best-practice way. You can perform login via social login and/or by a local login (ie, what you’re used to with forms-based authentication in ASP.NET). You can configure properties and claims with which your application can use for authorization.

The code example they use can be found here. This particular example is a Xamarin Forms app that uses the msal library to authenticate against an AD B2C app (either created by you or at another domain).
This code example also suthenticates against a webapi too. You can find the code for the webapi here.

I was able to run/test the sample code against the AD B2C application I created in my “free tier” account. So this should not cost you money if you sign up for an Azure free tier subscription.

In the future should I create a mobile app that would need a “single truth for authentication”, I would be using this particular approach as it combines the concept of what you’re used to with the “Membership provider” (ie, registering yourself as a user to the app) along with being able to sign in using a social provider.

Mobile, Xamarin

Visual Studio 2017 and Xamarin for the Mac.

About 6 weeks ago, I downloaded Visual Studio 2017 for the Mac to explore/re-familiarize myself with Xamarin development.

I visited here to downloaded the version for the Mac.

I’ve since taken several Xamarin courses on Udemy (Xamarin.ios, Xamarin.android and Xamarin.forms, etc..) and have done all of them using my Mac (not Windows) environment just to see how “ready” VS2017 for the Mac is.

I must say that it’s quite ready. Although a few of the settings/options are different with VS2017 on the Mac vs Windows, it’s negligible and you can pretty much toggle back and forth between them.

All in all, I give it a thumbs up. Obviously, you cannot write a Windows UWP Xamarin app on the Mac, but you can easily write iOS and Android native apps. VS2017 has full support for XCode 9.1 no.