title: Simple UITableViewCell casting fails intermittently
body: <p>I have a UITableView that registers a <code>PaymentAddressTableViewCell</code> which has a method on it called <code>validate</code> which looks at the <code>cellType</code> enum and applies a specific validation to the text field in the cell. </p>
  
  <pre><code>let tableView = UITableView()
  tableView.register(PaymentAddressTableViewCell.self, forCellReuseIdentifier: "PaymentAddressCell")
  tableView.dataSource = self
  tableView.delegate = self
  ... more layout
  </code></pre>
  
  <p>I'm seeing in Fabric that sometimes the following cast fails. So far I've chalked it up to something internal to UIKit failing. It could also be a misrepresentation of line number since the app is compiled for production. But for the sake of this, let's assume it's not. </p>
  
  <p>I started by changing the force unwrap to a <code>guard let</code> as you'll see below. That else case should never really hit. Casting is pretty simple...</p>
  
  <pre><code>for i in [0, 1, 2, 3, 4] {
      let indexPath = IndexPath(row: i, section: 1)
      guard let cell = tableView.cellForRow(at: indexPath) as? PaymentAddressTableViewCell else {
          ... this should never really be hit
      }
  }
  </code></pre>
  
  <p>Any idea what this might be or how I might avoid the cast failing?</p>
  
  <p>Thanks </p>
  
  <p><strong>Edit</strong> <code>cellForRowAtIndexPath</code> code</p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "PaymentAddressCell") as! PaymentAddressTableViewCell
      cell.textField?.returnKeyType = .done
      cell.textField?.delegate = self
  
      switch (indexPath.section, indexPath.row) {
      case (0, 0):
          cell.fieldType = .cardNumber
          cell.textField?.placeholder = "5555123456789999"
          cell.textField?.keyboardType = .numberPad
          cell.textField?.addTarget(self, action: #selector(cardNumberChanged(_:)), for: .editingChanged)
      case (0, 1):
          cell.fieldType = .expiration
          cell.textField?.placeholder = "01/20"
      case (0, 2):
          cell.fieldType = .cvv
          cell.textField?.placeholder = "CVV"
          cell.textField?.keyboardType = .numberPad
          cell.textField?.addTarget(self, action: #selector(cvvChanged(_:)), for: .editingChanged)
      case (1, 0):
          cell.fieldType = .address
          cell.textField?.placeholder = "123 Main Street"
          cell.textField?.autocapitalizationType = .words
          cell.textField?.keyboardType = .default
      case (1, 1): // address line 2
          cell.textField?.placeholder = "Apt 3"
          cell.textField?.autocapitalizationType = .words
          cell.textField?.keyboardType = .default
      case (1, 2):
          cell.fieldType = .city
          cell.textField?.placeholder = "City"
          cell.textField?.autocapitalizationType = .words
          cell.textField?.keyboardType = .default
      case (1, 3):
          let dict: [(key: String, value: String)] = viewModel.statePickerOptions.sorted(by: {
              return $0.0 &lt; $1.0
          })
          cell.textField?.placeholder = "State"
          cell.statesDataSource = dict
          cell.fieldType = .state
      case (1, 4):
          cell.fieldType = .zipcode
          cell.textField?.placeholder = "Zipcode"
          cell.textField?.keyboardType = .numberPad
      default: break
      }
  
      return cell
  }
  </code></pre>