Nope, it can’t be done! Well that’s not entirely true.
Dave is certainly a man of mystery, but perhaps we can expand upon his cryptic answer? Associative references are, indeed, the answer, but what are they, and how can they be used to implement properties through a category?
I needed to do just that a while back when I was working on adding NSCoding functionality to UIImage. The advisability of doing that is debatable, but it was an interesting exercise, and it has its uses. Problem is, I wanted the user to be able to specify what format the image should be encoded into, and at what quality (if applicable). We can’t know for sure when the UIImage will get encoded, so we obviously have to store that information with it somehow.


