Objective-C categories are a powerful mechanism for extending existing Objective-C classes or grouping common APIs together.
NSURLPathUtilities category on
@interface NSURL (NSURLPathUtilities) + (NSURL *)fileURLWithPathComponents:(NSArray *)components; @property (readonly, copy) NSArray *pathComponents; // ... @end
It adds on the Objective-C
NSURL class some properties and methods.
NSURL (see Objective-C Classes).
NOTE: This applies also to Objective-C categories added by third-party frameworks.
var url = NSURL.fileURLWithPathComponents(["foo", "bar"]); console.log(url); // "foo/bar -- file:///" console.log(url.pathComponents); // ["/", "foo", "bar"]
Objective-C categories can implement Objective-C protocols and their methods and properties will be also exposed.