0
What is the use of category in Objective-C?

Open 1 Answers 33 Views Technology

What is the use of category in Objective-C?

1 Answer

0

You typically use a category to add methods to an existing class, such as one defined in the Cocoa frameworks. The added methods are inherited by subclasses and are indistinguishable at runtime from the original methods of the class. You can also use categories of your own classes to: Distribute the implementation of your own classes into separate source files — for example, you could group the methods of a large class into several categories and put each category in a different file. Declare private methods.

#import “SystemClass.h”

@interface SystemClass (CategoryName)

// method declarations

@end

by (301k points)
...