How to return array of enum in Obj-C

Viewed 31

I have table view sections defined by Obj-c enum. I need to return array of enums but specifying type of enum of array raises error.

typedef NS_ENUM(NSUInteger, MySection) {
    MySectionOne,
    MySectionTwo,
    MySectionThree
};
// ERROR: Type argument 'MySection' (aka 'enum MySection') is neither an Objective-C object nor a block type
- (NSArray<MySection> *)sections {
    
}

0 Answers
Related