I’ve heard that lately it’s possible to create private methods by declaring the interface once again in the .m file. But what exactly is the syntax like?
If it matters: Under ARC.
- Must it appear right before @implementation?
- Does it look exactly like the @interface declaration in the .h file?
- Must it duplicate the information about inheritance and protocol compliance?
- Since when is this available? What’s the oldest iOS and Objc-C runtime that supports it?
Header file:
Implementation file:
Docs on ivar scopes.
For more information on what’s new in the above snippet and what it’s all about (compatibility, etc) see the WWDC 2011 Session #322
Xcode 4.2 brought the hidden private ivars.
Class extensions have been around for quite a while.