API Development

New sample app: Cross-platform Drawer menu

sample app

For quite some time, it has been possible to build an Android app with a Drawer menu in Titanium. However, on the iOS version, there is no native alternative. Over time, there have been other solutions like third-party modules or widgets that came out to support it on iOS, but they’ve never been purely Titanium or nicely implemented cross-platform.

READ MORE: Check out getting started with Dark Mode iOS 13.

With introducing a cross-platform NavigationWindow in Titanium SDK 8.0, building a cross-platform solution has become much easier. And this was the point I thought would be a good time to build a sample app everyone can check out and build their app on top of.

READ MORE: Speed up your app development, upgrade to Titanium SDK 8.

Sample app is simple

The sample app is simple and straightforward. On Android, it still uses the native DrawerLayout, on iOS it builds a custom implementation. Because of the way they structure the code, everything is reusable. The menu content itself comes from a “menu” controller. It uses this in the LeftView on Android.

READ MORE: Learn some common support questions for Android.

For iOS, they have created a custom Window to have the same look and feel as you’d expect from a drawer menu. A slide-in from the left and the background fading out. It again requires the same menu into that controller so you only need to care about content once.

I have uploaded the entire sample app to the appcelerator-developer-relations account on GitHub. Have a look.