Reputation: 2563
where do you define a struct in an objective-C class. The header file?
Sorry if this is a total noob question, Thanks in advance.
Upvotes: 0
Views: 442
Reputation: 16709
I tell you a little secret: 'id' type is pointer to the structure. So you actually using them all the time. However sometimes it is more convenient to use plain C structures:
So as Objective C is the superset of C all the rules from C are applied to Objective C. It means you can declare struct everywhere, where C allows it: in the header if you want this struct to be public or in an implementation file.
Upvotes: 2
Reputation: 54049
Depends if your struct needs to be public...
If so, define it in the header file (interface). If not, you can define it in the implementation file.
Upvotes: 0