New sample app: Cross-platform Drawer menu

sample app
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.

3 COMMENTS

    • Glad you like it! It is not directly possible to implement it as-is in your classic app, however, there are 2 ways of doing it. One is looking at how the alloy code is set up and write the corresponding code in classic. After all, Alloy is just a layer on top of Classic and the end-result is compiled into classic. You can see the classic code of my sample app in the Resources/iphone/alloy directory after compiling the app once.

      An even better solution would be to convert your classic app to an Alloy app easily within an hour, no matter how big your app is. All you need to follow is step one in this blogpost: https://devblog.axway.com/mobile-apps/moving-your-classic-titanium-app-to-alloy/. Further steps are optional.

Comments are closed.