title: Swift - Cast Int into enum:Int
body: <p>I am very new to Swift (got started this week) and I'm migrating my app from Objective-C. I have basically the following code in Objective-C that works fine:</p>
  
  <pre><code>typedef enum : int {
      MyTimeFilter1Hour = 1,
      MyTimeFilter1Day = 2,
      MyTimeFilter7Day = 3,
      MyTimeFilter1Month = 4,
  } MyTimeFilter;
  
  ...
  
  - (void)selectFilter:(id)sender
  {
      self.timeFilterSelected = (MyTimeFilter)((UIButton *)sender).tag;
      [self closeAnimated:YES];
  }
  </code></pre>
  
  <p>When translating it to Swift, I did the following:</p>
  
  <pre><code>enum MyTimeFilter : Int {
      case OneHour = 1
      case OneDay = 2
      case SevenDays = 3
      case OneMonth = 4
  }
  
  ...
  
  @IBAction func selectFilter(sender: AnyObject) {
      self.timeFilterSelected = (sender as UIButton).tag as MyTimeFilter
      self.close(true)
  }
  </code></pre>
  
  <p>By doing that, I get the error :</p>
  
  <blockquote>
    <p>'Int' is not convertible to 'MyTimeFilter'</p>
  </blockquote>
  
  <p>I don't know if my approach (using the tag property) is the best, but anyway I need to do this kind of casting in different places in my app. Does anyone have an idea of how to get rid of this error?</p>
  
  <p>Thanks!</p>