Objective-C version of https://github.com/aschuch/StatefulViewController