Chapter 22. Categories
Although the engineers at Apple are very wise, one day you will think, “Golly, if only they had put that method on that class, my life would be so much easier.” When this happens, you will want to create a category. A category is simply a collection of methods that you would like added to an existing class. The category concept is very useful, and it is surprising that so few object-oriented languages include this powerful idea.
Creating categories is easier than talking about them. In the previous chapter, you added pasting capabilities to your BigLetterView. Note, however, that if the string on the pasteboard has more than one letter, the paste attempt will fail because BigLetterView is capable of displaying only one ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access