title: Encode/Decode enum for Swift (Xcode 6.1)
body: <p>I have </p>
  
  <pre><code>var priority : Priority! = Priority.defaultPriority
  
  func encodeWithCoder(aCoder: NSCoder) {
          aCoder.encodeInteger(priority.toRaw(), forKey: "priority") //toRaw may not yield the result I am expecting
      }
  
      required init(coder aDecoder: NSCoder) {
          priority = aDecoder.decodeIntegerForKey("priority") //complaining about conflicting types
      }
  </code></pre>
  
  <p>with the enum being the following:</p>
  
  <pre><code>enum Priority : Int {
          case defaultPriority = 0
          case lowPriority = 1
          case mediumPriority = 2
          case highPriority = 3
      }
  </code></pre>
  
  <p>What is the best way to encode/decode this?</p>