What is the difference between a category and a class extension?

A category is a way of adding additional methods to an existing class, without having to subclass it. For example, you could add a category to the NSString class to add a method that converts a string to a URL.

A class extension is a way of adding additional private methods and properties to an existing class. For example, you could add a class extension to the UIViewController class to add a private method that handles the loading of view data from a remote server.

What is the difference between a protocol and a category?

A protocol is a set of rules that govern how computers communicate with each other. For example, the Transmission Control Protocol (TCP) is a protocol that allows two computers to communicate with each other over the internet.

A category is a way of organizing or grouping related items. For example, a website might have a category for books, and each book would be listed under that category.