title: Tableview cell subtitles
body: <p>My tableview cell subtitles aren't showing when I use this:</p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
  var cell:UITableViewCell?
  
  if tableView.tag == 1 {
  
      guard let latestCell = tableView.dequeueReusableCell(withIdentifier: "latestCell") else {
          return UITableViewCell(style: .subtitle, reuseIdentifier: "latestCell")
      }
      latestCell.textLabel?.text = latest[indexPath.row]
  
      latestCell.detailTextLabel?.text = latestSub[indexPath.row]
  
      latestCell.accessoryType = .disclosureIndicator
  
      return latestCell
     }
  }
  </code></pre>
  
  <p>But then if I use this:</p>
  
  <pre><code>else if tableView.tag == 2 {
  
      let olderCell = UITableViewCell(style: UITableViewCellStyle.subtitle, reuseIdentifier: "olderCell")
  
  
  
      olderCell.textLabel?.text = older[indexPath.row]
  
      olderCell.detailTextLabel?.text = olderSub[indexPath.row]
  
      olderCell.accessoryType = .disclosureIndicator
  
      return olderCell
    } else {
      return cell!
    }
  }
  </code></pre>
  
  <p>The subtitles load perfectly, but after I close the app and reload the view, the app autoquits without giving a crash log or taking me to the debugging-tab.</p>
  
  <p>I know that the arrays from which the data comes from are fine, and I think that I've set up everything right in the storyboard. A lot of similar questions have already been posted on the subject, but they all seem to come down to forgetting to set the cellStyle to .subtitle. Thanks in advance for any help I get!</p>
  
  <p>BTW. My regular cell titles are working just like I want them to. No problem there.</p>
  
  <p>EDIT:</p>
  
  <p>I think the problem is that I can create a default-styled cell with no problem. But then when I try to set the style to .subtitle, it loads correctly the first time but when opening the second time, it crashes. Is there a way to use these both declarations together in a way that they don't eliminate each other out;?</p>
  
  <pre><code>guard let latestCell = tableView.dequeueReusableCell(withIdentifier: "latestCell") else {
      return UITableViewCell(style: .subtitle, reuseIdentifier: "latestCell")
  }
  </code></pre>
  
  <p>and: </p>
  
  <pre><code>let latestCell = UITableViewCell(style: UITableViewCellStyle.subtitle, reuseIdentifier: "latestCell")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lHZpS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lHZpS.png" alt="storyboard"></a></p>