Reputation: 3407
I created a class in Xcode 4.3, and it created the header and implementation files with @interface and @implementation in the correct locations, but there is also an @interface in the implementation file like this:
@interface MyClassName ()
@end
Why does Xcode put that in the implementation file and what is it for?
Thanks, Kurz
Upvotes: 8
Views: 1607
Reputation: 34263
Xcode automatically creates a class extension, which allows you to implement "private" methods.
Class extensions are unnamed categories and have been introduced with Objective-C 2.0.
One advantage of class extensions is, that the compiler will warn you, if you forget to implement one of the methods declared in the anonymous interface.
Upvotes: 13