I have an enum in my objective-C code similar to this:
typedef enum {
FRUIT_APPLE = 1,
FRUIT_PEAR = 2,
FRUIT_BANANA = 3,
// etc.
} Fruit
I need to be able to return an array of these in a method, something like this:
@implementation FruitTest
static Fruit fruits[] = {FRUIT_APPLE, FRUIT_BANANA};
+(Fruit[]) fruits
{
return fruits;
}
@end
However, this generates a compile error:
#1 'fruits' declared as method returning an array
#2 Incompatible types in return
Any ideas on how to solve this? Thanks!