-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
State Restoration #65
Comments
I must confess I haven't done much with state restoration in the past, so I'm a little unclear as to what is causing the problem. State restoration should certainly be a first class citizen of this library, so I'm interested in learning what the issue is and how we should be handling it. Keep me updated on your progress. I'll try and find some time to dig in as well. |
That's totally fair. I'm currently working with an Apple Engineer to help debug the problem, and I'll absolutely let you know what I find out. Hopefully it will be in the form of a Pull Request.:) |
I've answered this question on SO, I think the problem is outside of MMDrawerController. However as noted in the report here it would be useful if MMDrawerController implemented en/decoreRestorableStateWithCoder. I've had to do very similar to above in an MMDrawerController subclass to get restoration working in my app (see below). I'm not sure if there is any drawback to including this in the library, but it seems to me most apps will want to implement restoration, and having a drawer at the root makes something like the below necessary.
|
Exactly. I'm going to be opening up a Pull Request soon with changes very similar to this, once I get it working. I just looked at your answer on SO and I think I know the problem. Thanks so much for responding and I'll update here when I've got something working. |
Closing this since it's not MMDrawerController's problem |
Hey there,
First off, thanks so much for the work you've done with this library. So simple to use and such a nice lib.
I'm trying to add State Restoration to my app and am running into a problem. I'm not sure if it's in the code (the state restoration machinery) that I've set up or if something unexpected is happening in your lib that I'm not aware of (I haven't been able to find anything yet).
I have an SO question open: m/questions/17934668/ios-state-restoration-with-custom-container-view-controller-mmdrawercontroller but I'll also post here since it will be easier to talk about.
I've added this to MMDrawerController:
Essentially I'm storing the left and center view controllers so that when restoration happens, I can get them back and add them to the main MMDrawerController.
In the first CenterViewController that loads, I added two buttons that change the color of the background. I can change it to red, for example, kill the app, and come back in and the background is still red. Perfect.
However, if I open the left drawer, and select an item which swaps out the center view controller, when I quit the app and come back in, during restoration the two logs in
decodeRestorableStateWithCoder
are now null.For some reason changing out the center view controller messes with the coder.
Again, I'm not sure if the problem is in my code or if something unexpected is happening, but I've been on this for a few days and figure I should ask.
Thanks!
The text was updated successfully, but these errors were encountered: