title: Is there anything like a Java enum in Objective-C?
body: <p>I have a situation in Objective-C where a Java-style enum would be very helpful. I have a set of layer types, and each layer has its own persistence value associated with it (stored in seconds). I want to keep these layer types in an enum, since they're too similar to make into separate classes, like so:</p>
  
  <pre><code>typedef enum {
      ExplosionLayerType,
      FireworkLayerType,
      FireLayerType,
      FireJetLayerType
  } FXLayerType;
  </code></pre>
  
  <p>In Java, I could easily associate these two values with something like this:</p>
  
  <pre class="lang-java prettyprint-override"><code>public enum FXLayerType {
      Explosion(3),
      Firework(6),
      Fire(7),
      FireJet(-1);
  
      private int persistence;
  
      FXLayerType(int persistence) {
          this.persistence = persistence;
      }
  }
  </code></pre>
  
  <p>Is there a simple way to create a sort of lightweight class like this in Objective-C, or will need to resort to more primitive methods?</p>
  
  <p>EDIT:</p>
  
  <p>Various people have suggested doing something like this:</p>
  
  <pre><code>typedef enum {
      ExplosionLayerType = 3,
      FireworkLayerType = 6
  } FXLayerType;
  </code></pre>
  
  <p>This will not work for me, since I may have something like this (Java-style enum):</p>
  
  <pre><code>Explosion(3),
  Firework(6),
  Dust(3);
  </code></pre>
  
  <p>In Java, Dust and Explosion will be treated as unique values, but direct assignment with C enums will treat them as being exactly the same.</p>