What exactly is an "extension" in objective-c?
It's something开发者_运维知识库 different than a category, right?
From The Objective-C Programming Language: Categories and Extensions:
A category allows you to add methods to an existing class—even to one to which you do not have the source. This is a powerful feature that allows you to extend the functionality of existing classes without subclassing. Using categories, you can also split the implementation of your own classes between several files. Class extensions are similar, but allow additional required API to be declared for a class in locations other than within the primary class
@interface
block.
[...]
Class extensions are like “anonymous” categories, except that the methods they declare must be implemented in the main@implementation
block for the corresponding class.
精彩评论