How to declare unknown enum in header?
declaration, objective-c
Solution
Yes you can forward declare an `enum`:
enum things;
However I think you will run into issues if you start using compiler flags like `-pedantic` as I don't believe it's part of the ISO standard. I also think, like forward declaring a class, you can probably only use a pointer to it, as its size isn't known.
I've never, personally, ever had to do this and prefer to include the header file defining the `enum` (and I don't think forward declaring the `enum` is cleaner than including the file anyway).
Bottom line: Don't bother.
Problem
I know you can use the `@class` word to declare an unknown class in an objective-c header file. Is there a way to declare an unknown `enum` inside a header class? For instance, is there a way to prevent the compile error for `someEnum`? ``` #import <Foundation/Foundation.h> @class UnknownClass; @interface Foo @property (nonatomic, strong) UnknownClass *someObject; @property (nonatomic) UnknownEnum someEnum; @end ```