Xamarin and Azure Office Hours Recap: Mid-2019

Avatar

Matt

I ♥️ Developers - Office Hours Recap Post Image

That’s right, I ❤️every single one of you(!) and I want to know more about your stories building mobile apps. Share the stories of your successes, as well as the not-so-successful adventures. Tell us what we can do better. This is your chance to ask your questions, any questions, about Xamarin or Azure, whether you’re new to mobile development or a seasoned developer. I look forward to talking about mobile development in general and I promise to to my best to answer at the best of my ability. And if I don’t know, I will find somebody who does. So make sure to sign up and share your your stories with me during My Office Hours!

On to recap the first half of 2019!

First Half 2019 Recap

In the first half of this year, a couple of topics that came up several times that are worth mentioning to a wider audience:

  • Xamarin.Forms Shell
  • Android Emulators
  • Hot Reload
  • Xamarin.Forms Architecture

Let’s take a look at each of these to find out what the community is saying.

Xamarin.Forms Shell

Xamarin.Forms 4.0 unleashed a whole new paradigm of developing apps: Xamarin.Forms Shell. And any time something as different as Shell comes around, there are always questions.

The question I heard most often was: What exactly is Shell?

At its heart, Shell provides a container for your app.

Shell App with Flyout

Think about the code you have to write that builds up the user interface that contains your app. You may have a tab bar at the bottom. There could be a flyout containing various options and menu items. And most likely a Navigation Page is somewhere in the mix too.

Shell app tab bar

You have to write that code to build up the container of the real user interface of your app over and over across every app you build. And most likely that container code is not fundamental to your app’s core business goal.

So enter Shell. It provides a way to create that container for your app so you can concentrate on the app’s real purpose.

The XAML or C# that you use to create the flyouts and tabs are different. So it takes a bit of getting used to.

The great thing about Shell is that its UI is customizable, so it can match your app’s look. And it provides a host of features for navigation. It even provides some hooks to allow custom renderers.

Is Shell right for my app?

Now that one is more difficult to answer so I would say, it depends!

Shell is opinionated. If you use it, you have to be comfortable with your app sitting within tabs, or flyouts, or both.

Shell provides a new means of page to page navigation, but you can opt-in to that, you don’t need to use it. But to opt-in, you first have to use Shell. In other words, you can’t use Shell’s navigation and its new features without using Shell.

So I haven’t answered the question yet, Is Shell right for my app? Yes, if you find yourself writing the same code over and over again to represent flyouts and tabs. But if you are doing a customized user interface, then maybe not.

If you’re starting a new app, give Shell a try, I think you’ll be pretty happy at how it turns out.

Android Emulators

Android emulators can be confusing. Hyper-V? HAXM? Which one is recommended? Which one is faster? What’s with all the H’s anyway?

The answer here isn’t as clear cut as it would seem (or you’d hope it be).

The Hyper-V emulators work better when you have Docker, virtual machines, and other various developer tooling installed.

But, the HAXM emulators are generally the more stable and performant option. But they don’t play as well with the tools mentioned above. So HAXM might not work with your particular development machine setup.

The good news coming out of this? The Hyper-V team is working on some documentation that will clear some of the confusion of when to use what. Keep an eye out for that.

Hot Reload 🔥🔄

In almost every Office Hour session, this has been the most asked question: When will Hot Reload be a part of Xamarin?

I’m happy to tell you that it’s out there now!

At the Xamarin Developer Summit in July 2019, Maddy Leger announced that the Xamarin tooling now supports XAML Hot Reload 🔥🔄! We are still in the Preview stage as we’re working out the final implementation details but you can sign up to be part of the early preview program.

What does XAML Hot Reload do? While debugging, any changes you make to the XAML will appear on the simulator, emulator, or device. And there are two great parts of this:

  • One, the state is maintained. View model properties and your bindings will keep their values when the reload takes place.
  • Secondly, XAML Hot Reload allows you to make typos without crashing! I “fat-finger” everything, but my app won’t crash out of the debugger. Sweet!

Xamarin.Forms Architecture

There are two things that can raise the passion of developers. Tabs vs. spaces. And the best way to architect your app. I won’t weigh in on tabs vs. spaces. (And luckily, nobody has ever asked me about them either!). But people have asked for some guidance and patterns around architecting a solid Xamarin.Forms app. Every app is different. But there are general best practices you can follow and we have them outlined in our documentation.

MVVM and Dependency Injection questions have come up in a couple of conversations. There’s a great eBook called Enterprise Application Patterns using Xamarin.Forms which goes over those two topics in-depth. In fact, all the topics in that book are well worth a read.

Local data storage pops up a lot too. The docs have you covered there as well.

I also get asked about whether there are any apps out there showing a full, working, application – with all the ins-and-outs put together. We would recommend that you take a look at our SmartHotel360 app on GitHub to see one in action.

Summing It Up

It was an exciting couple of months, and thank you to everybody who took part in the office hours! If you’re interested in talking about anything Xamarin, mobile development, or Azure, please don’t hesitate to sign-up for my office hours. I would ❤️ to hear from you!

Avatar
Matt Soucoup

Senior Cloud Developer Advocate, Developer Relations

Follow Matt   

0 comments

    Leave a comment