Category is useful when you want to alter the behaviour of all instances of that class even when the source code is not available to you.
Subclassing is useful when want to alter the behaviour of some instances of that class and keep intact for other instances.
Categories cannot store state, whereas subclass can store state.
While using category you need to be extra cautious because it can change the behaviour of all instances in your project without any warning especially when you don’t have source code for that class. It is recommended to use subclassing on third-party and private framework classes than category.
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!