In objective C, a Category will only "be used" in a class if I import it. So if I have a Category NSString+category
, I have to #import NSString+category.h
in each class I want to use it.
I have such a Category, and some of the classes I want to use it in are written in Swift. If I expose this category to Swift by putting it in the Bridging header, ALL swift classes will use it. How can this be avoided?
Note: My Category is actually on UIViewController
and the code I have put there must only be used by SOME ViewControllers. It feels wrong and unneccessary to use this Category on the "other" ViewControllers.