Happy new year, dear readers! Boy, the past month has been a little crazy. Appcelerator recently deprecated the Titanium.UI.iPhone.NavigationGroup API as of Titanium 3.2. As a result, cross platform navigation controllers, like the ones that I’ve been writing and posting on my github account, just stopped working. And that’s when people all over just lost their s*@$!. I started getting emails and comments from people, on this website, and on my github account, some DEMANDING that I fix my navigation controller ASAP.
Now, as some of you are aware, and I’m afraid this bears repeating, the code I post on my github account is free/open source. This means I work on this stuff and share it with the world in my “free” time, when I’m not busy working on other things. So, I’ve decided to post some rules for making code requests, in hopes of heading off these crazy antics in the future.
But first, let me explain briefly how the deprecated API impacted the Navigation Controller and what changes I made to fix it.
As I’ve explained in past posts, Titanium has a different way of managing stacks of windows for iOS and for Android. If you’re writing a cross platform mobile app, you COULD put branching statements all over your code, wherever you’re opening or closing a window in your app, and have that branching code handle it differently depending on whether it’s an Android or iOS app. OR, you can write your own API/interface that handles this code branching for you, and just use that API. That’s what my Navigation Controller is: an API, to handle this specific use case. It is only useful for managing stacks of windows in the same screen; it is not needed for displaying windows in different tabs of the same app.
For iOS, before Titanium version 3.2, you needed to use the Ti.UI.iPhone.NavigationGroup to manage your stack of windows. But since Ti 3.2 came out and deprecated that API, you now need to use Ti.UI.iOS.NavigationWindow. The second change is what to call when you’re opening/closing a window and this one’s a little confusing. To open a window within your NavigationWindow group, you need to call openWindow(), unless it’s the first window in your group, then you just call open(). To close a window within your NavigationWindow group, you need to call the closeWindow() function, unless it is the only window left in your group to close, in which case you call close(). Clear as mud? 🙂 These changes affect the iOS part of the Navigation Controller only; the Android part of the code continues to function as before.
Hope you find this new Navigation Controller useful. I’d like to thank Kevin Whinnery, former developer evangelist of Appcelerator, who wrote the first Navigation Controller and to Matt Lanham for improving on it. The first version of my Nav Controller was based on their code. And thanks to Mike (never got his last name) for posting his version on github, which this current version of mine is mostly based on (I’ve just been modifying it for my own use ever since :)). And thanks to Manuel Conde, for also kindly sharing his version of the Nav Controller for all my dear readers to use.
And now, before I close, some rules moving forward on how I’m going to manage code requests from now on.
First of all, the main reason I post code on github is to share what I’ve learned with others, and I hope to encourage other people to do the same. If we can help and learn from one another, then we can all become better Ti programmers in the process, no? But how can I do that without causing myself undue amounts of stress?
So, here are the new rules for making code requests:
Good – Ask nicely for updates or post questions for myself or others to answer. The key here is to be nice: ask for help (don’t demand it, this is free/open source code after all); if you briefly introduce yourself and say hello, that would be a nice touch; and remember there is no guarantee on when/if anyone will be able to answer your question. Rude comments and requests will simply be removed from the website.
Better – Post your own solution in a github repo and post the link to that repo here, in the comments. I decided this was better than asking for pull requests and managing those. It turns out that people have different ways of implementing the same things, and some people have their own style or way of writing code, which is just fine. So, rather than telling people, “This is the only way to write a cross-platform navigation controller,” I’d like to invite people to share their own versions.
Best – If you have no questions and nothing to add, but you find my contributions or those of others who post here useful, please share your compliments and thanks here. People often comment online to complain or demand things, but not enough people write to say ‘thank you’.
Here’s to a kinder, gentler year in 2014. Enjoy the new, updated Navigation Controller, and if you have anything to add, please make sure to follow the new rules posted here.
All my best,