mutualmobile/MMDrawerController — pull request #271 by pronebird (2014-07-04 15:51:51+00:00)
Title: Do not forward appearance events to central VC when drawer is offscreen

The idea is to avoid sending appearance events when setting new central controller before drawer put into view hierarchy (or offscreen). This PR fixes issue #261 related to state restoration.

This patch also adds some minor optimization for side controller setter method to avoid reseting the same view controller. This does make sense with state restoration because at the moment all controllers will be set twice, first time when your code actually initiates other controllers from storyboard and second time while state restoration decoding.

I tested this patch in my app with and without state restoration and everything works. I haven't tested hot-swap of central controller, but I believe it should work as before.

The good thing, it seems state restoration is smart enough and grabs the last instance of sidebar/central controller instantiated using `-[UIStoryboard instantiateViewControllerWithIdentifier:]`. If you create controllers manually, then you end up with two different sets of controllers I assume.

If you ask me, I do not encode child VCs for my controllers, because I create them in code anyway. Instead, I save properties that will help me to restore the state of those controllers. From my observations, saving child controller is only makes sense when you use embed segue in storyboard, then you leverage Storyboard. But essentially it always creates this controller for you, so you never even decode it, you only encode it.