I'm writing an iOS app in which I have a model class that is going to initialize itself with an XMLElement I give to it.
I'm using TBXML for the XML part.
The header for the model class looks like this:
@interface CatalogItem : NSManagedObject
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSManagedObject *group;
-(id)initWithXMLElement:(TBXMLElement*)element;
@end
Now instead of including the header in which TBXMLElement is defined, I'd like to forward declare it with: struct TBXMLElement
before the class definition. I'm however getting an "Expected Type" error wich tells me my declaration isn't working. Is this not how I would got about this?
As I understand it, including header files in header files is bad practice. The compiler doesn't need to know the inner workings of TBXMLElement
, just that it exists or will exist at compile time.