title: Access enum inside struct
body: <p>I'm trying to populate a UITableView with an array of elements. Those elements are structs:</p>
  
  <pre><code>public enum itemNumber {
    case Item1
    case Item2
    case Item3
    case Item4
    case Item5
    case Item6
  }
  
  public enum sectionNumber {
    case Section1
    case Section2
    case Section3
    case Section4
  }
  
  public struct Item {
    var itemNumber: itemNumber?
    var sectionNumber: sectionNumber?
    var checkmark: Bool
  
    init(sectionNumber: Int, itemNumber: Int, checkmark: Bool) {
      switch sectionNumber {
      case 0: self.sectionNumber = .Section1
      case 1: self.sectionNumber = .Section2
      case 2: self.sectionNumber = .Section3
      case 3: self.sectionNumber = .Section4
      default: break
      }
      switch itemNumber {
      case 0: self.itemNumber = .Item1
      case 1: self.itemNumber = .Item2
      case 2: self.itemNumber = .Item3
      case 3: self.itemNumber = .Item4
      case 4: self.itemNumber = .Item5
      case 5: self.itemNumber = .Item6
      default: break
      }
      self.checkmark = checkmark
    }
  }
  </code></pre>
  
  <p>On my Controller class I want to check the section number of each <code>Item</code> in order to assign it to the proper section:</p>
  
  <pre><code>func getNumOfItemsPerSection(section: Int) -&gt; Int {
      var num = 0
      switch section {
      case 0: num = self.items.filter { $0.sectionNumber == .Section1 }.count
      case 1: num = self.items.filter { $0.sectionNumber == .Section2 }.count
      case 2: num = self.items.filter { $0.sectionNumber == .Section3 }.count
      case 3: num = self.items.filter { $0.sectionNumber == .Section4 }.count
      default: break
      }
      return num
    }
  </code></pre>
  
  <p>This method doesn't compile: 
  <strong>Binary operator '==' cannot be applied to operands of type 'sectionNumber?' and '_'</strong></p>
  
  <p>What's the proper way of doing that?
  Thanks!</p>