title: Swift enum error: Braced block of statements is an unused closure
body: <p>Enums in Swift look to be really powerful, but... I must be missing something about how I'm implementing this. I want to define some actions for a remote media player. Seems like a good use case for an enum. I've defined the allowed message types in the Enum, and I'd like to use it to get a modified parameter dictionary. The parameters will eventually get sent as JSON to the player. At the moment, I'm getting a <code>Braced block of statements is an unused closure</code> error. Here's the relevant code:</p>
  
  <pre><code>public enum PlayerCommand {
  case Play
  case Pause
  case Load(String)
  
  func params(cmd_id:NSInteger) -&gt; [String : Any] {
      var dict = [
          CMD_ID      : cmd_id,
          TYPE        : "LOAD",
          AUTOPLAY    : false,
          MEDIA       : NSNull()
      ]
      switch self {
      case .Load(let media): {
              dict.updateValue(media, forKey: MEDIA)
          }
      case .Play: {
              dict.updateValue("PLAY", forKey: TYPE)
              dict[CURRENT_TIME] = NSNull()
          }
      case .Pause: {
              dict.updateValue("PAUSE", forKey: TYPE)
          }
      default:
      }
      return dict
  }
  }
  </code></pre>
  
  <p>I am sure that there is also a more functional (swiftian?) way to express this, as well, but I'm not having a lot of luck with the syntax yet. map?</p>