How To Make A Hamburger Menu With MvvmCross

This post explains what I went through trying to find a working sample Hamburger/Slide Out menu using MvvmCross. If you’re a developer trying to figure this out you can skip to the bottom of this post to see what actually worked. For the rest of you it’s a cautionary tale about working in the framework-heavy, open source, Xamarin ecosystem.

Our Hero’s Task

I needed to build a hamburger menu for an app. Most of my work is native iOS but this app is using Xamarin and MvvmCross.

I begin my journey with the approach to has worked for me with every language and framework I’ve had to learn. Ruby, iOS, .NET & even bleeding edge things like Ethereum.

Google Fu

First I’ll search for hamburger menu MvvmCross. I’m expecting an easy win since this is a common app pattern on a widely used platform.

The first result is a Sample Project from the MvvmCross team

Success!?

Almost. It doesn’t run on 64 bit iOS simulators. That’s no big deal. Just update a couple build settings and we’re good. The sample even shows how to integrate it with a login menu. The sample builds and runs in the simulator. I’m getting ready to drop the mic.

Let’s integrate the sample into our app. Compile errors! What the Nuget it going on?

Version Mismatch

Oh no. Our app using MvvmCross 5, the sample is for MvvmCross 4.

With a little spelunking/guesswork/wizardry I could deduce the class names have changed and the functionality I want has been split out into a different Nuget Package.

Not a big deal. I can update MvvmCross, add the new Nuget package and get the sample running. Maybe I’ll even create a pull request to update the sample so other devs won’t have the same problem I did. There’s even a StackOverFlow answer that describes how to do it.

Still Doesn’t Work

Doesn’t work. I’m missing something but I don’t know what. Let’s ask for more help. I push what I’ve tried to GitHub and ask a question in the Xamarin Slack workspace. Maybe I’ll get a response? In the meantime let’s go back to google.

Google Fu (Slight Return)

The 2nd result is from Marc Bruins.

This is the post I wish existed! Unfortunately it’s for MvvmCross 4.

Luckily he puts a link to a NEW sample project. It’s been moved and renamed to the XamarinSidebar

Fin (The Solution)

For devs who just want a sample: here it is!

I’m glad to have a solution, but I wish I hadn’t gone down that other path.

Conclusion And Takeaways

External frameworks designed to speed up development often result in slowing it down.

Most experienced native developers and leads have developed a strong preference towards keeping 3rd party frameworks out of their codebases. They know how much effort is required to keep them running as the OS changes. Mobile platforms move fast. iOS updates every year. Updates to cross platform frameworks like Xamarin and React Native make this problem worse. Much of the time supposedly saved with cross platform is lost with problem like this.

You’re beyond Stack Overflow when dealing with a very mainstream implementation.

There simply aren’t enough people developing on these platforms for the advice ecosystem (blogs, Stack Overflow, forums) to match what is available for the established native iOS and Android platforms.

We need a way to deprecate outdated advice.

This isn’t MvvmCross’s fault. BTW Stack Overflow is not going to save us. Remember the Stack Overflow question from above? I posted an answer that showed where to find the sample project. This link would have saved me a days worth of effort had I known about it.

My answer was deleted by Stack Overflow moderators. I hope the next devs with this problem can find this post because Stack Overflow doesn’t care about valuable information if it doesn’t meet their style guidelines.

U Mad?

This is description of my experience trying to utilize MvvmCross. It also aligns with conversations I’ve had with other developers with years of native mobile and C# experience. This post isn’t meant to criticize those who’ve worked hard to make MvvmCross. MvvmCross is the result of a lot of effort and many people are having success with it. Thank you for your hard work!


Originally published at Sharp Five Software.