1

While converting Objective-C enums to NS_ENUMs, I came across like this, which seems strange to me:

enum nameA{
    valueA=1,
    valueB,
    // ...
    valueN
}nameB;

In the code, nameA and nameB were two different names. Does this enum have both nameA and nameB as its name? How would I convert it to an NS_ENUM?

Ky -
  • 30,724
  • 51
  • 192
  • 308

1 Answers1

1

Your example code is equivalent to:

enum nameA {
   ...
};
enum nameA nameB;

So it's not just a declaration of an enumeration, it's also the definition of a variable of that type. You'll need to take that into account when doing your translation. Something like:

typedef NS_ENUM(NSInteger, nameA) {
    ...
};
nameA nameB;
Carl Norum
  • 219,201
  • 40
  • 422
  • 469