pkluz / PKRevealController

PKRevealController is a delightful view controller container for iOS, enabling you to present multiple controllers on top of one another.
Other
3.85k stars 659 forks source link

`initWithFrontViewController` deprecated. #170

Open norswap opened 11 years ago

norswap commented 11 years ago

I updated from version 1.0b2 to 2.0.5 (yeah I know... but it was a legacy project). I'm wondering why the method family mentioned in the title are deprecated. I used to subclass PKRevealController. Is that bad form somehow?

pkluz commented 11 years ago

I deprecated them in favor of convenience initializers (class methods). The methods are already fairly verbose and long, and I saw no benefit in bloating the header with lots of possible ways to initialize the controller which might've just confused people and made it less readable. Instead I chose to only recommend the use of the + (instancetype)revealController… class methods.

You're free to still use those methods, as they will not be removed from the internals of the controller itself - only the public visibility might not make the cut in 3.0 which is at least a year off.

Summary:

norswap commented 11 years ago

Still, subclassing is fairly useful in some cases (in my case it was mostly about saving keystrokes and avoiding to have two view controllers where one would do).

What about leaving a single init-style method? It would make subclassing possible, albeit not as convenient as the recommended method.

Also, for anyone interested, here is how to inhibit the warning:

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self = [super initWithFrontViewController: XXX
    leftViewController: YYY
    rightViewController: ZZZ
    options: nil];
#pragma GCC diagnostic warning "-Wdeprecated-declarations"