3 ms·
Categories can patch some of that, but you still have to write ugly code once, and categories are not as elegant as fix in the API itself (e.g. you have to use
by alextgordon 16y ago
Categories can patch some of that, but you still have to write ugly code once, and categories are not as elegant as fix in the API itself (e.g. you have to use odd/prefixed method names in categories to avoid collision with potential future API).
If the API is really obvious then this doesn't matter, since the category will simply replace the API method with something that does exactly the same thing.
For example, there's no real need to prefix a category implementation of -cgColor because it couldn't conceivably do anything else.
If it really bothers you, then you can use the runtime to load methods into NSColor, first checking to see if they exist.