Day 5: What is Category in Objective-C?

Max
1 min readJan 26, 2018

--

Photo by Possessed Photography on Unsplash

Category is used to define additional methods to an existing class. Yes, even you don’t have its source code and even without subclassing it.

You can add methods, but not properties (possible in a non-conventional way, will save it for some other day.)

Three powerful features

  1. Can be used to split up class interface & implementation into several files to achieve MODULARITY in large projects.
  2. Definition iteself.
  3. Provide an effective way to achieve psuedo-private methods in Objective C.

Declaration & Implementaion :

Note the filenames as well.

That’s one question, see you tomorrow. If you ❤️ this article please give it a clap👏 and support my work. Also, smash that Follow icon 🟢 to get posts delivered to you on your couch. We are in this together 😇. Cheers!

Psst!👋, want to continue? Go to next article in the series or the previous one, or if you wish to start from beginning.

--

--

Max

Senior iOS Engineer | Swift | ObjectiveC | SwiftUI | Combine |