hover
hover

Reputation: 789

Where do you place an enum if you want your whole class to have access? (Objective - C)

I want to create an enum that is global. I've seen examples where they are declared within a method, but i want mine to be accessible by the whole class or even by the whole project (if possible)

What is the syntax for this?

Upvotes: 0

Views: 114

Answers (3)

No one in particular
No one in particular

Reputation: 2672

If you want to define it for the entire project without importing a header everytime you could put it in the precompiled prefix header. That's the file that's named something like "???Prefix.pch".

Upvotes: 0

zneak
zneak

Reputation: 138211

Put it at the file level, inside a header.

Upvotes: 2

Stephen Canon
Stephen Canon

Reputation: 106267

If you want the whole project to have access, put it in your class's .h file. If you want access in your class, put it in your class's .m file.

Upvotes: 0

Related Questions