I am working on a project with several custom classes. I have a CardModel
(NSObject) that has some integer properties to hold data, and a Deck
(NSObject) that has an array to hold a bunch of CardModels
and then a CardView
(UIView) that has a CardModel
as a property that I make when I select a CardModel
from a Deck
. And then I've got a bunch of UIViewControllers
that I move around on a UINavigationController
.
My question is about where and when to use the @class
compiler directive.
If I subclass a UIViewController
by making a new file and subclassing it, should I use the @class MyViewController
in the header of MyViewController.h
or .m
and does it go in the header of the file that actually uses the controller (like when one controller is going to instantiate another controller type and push it to the stack). Or do I need to use it at all? Is it only required if I actually add new properties to my class beyond what's in the stock implementation? It seems like I'm putting @class
all over the place just make sure I don't get errors but I don't fundamentally understand when I need it.
Thanks!