title: fatal error: unexpectedly found nil while unwrapping an Optional value in UITableViewCell
body: <p>Similar question is asked <a href="https://stackoverflow.com/questions/24948302/fatal-error-unexpectedly-found-nil-while-unwrapping-an-optional-value">here</a> but that doesn't solve this problem for me. I've added a <code>tableView</code> in a <code>ViewController</code>. Made extended the class with it's dataSource and Delegate and added the required methods for it.<br />Then I made a prototype cell in this table (Not the separate .xib for it) and made a class for that <code>TableViewCell</code> and collected the <code>@IBOutlet</code>:</p>
  
  <pre><code>    @IBOutlet weak var titleOfAccount: UILabel!
      @IBOutlet weak var lastModified: UILabel!
  
      @IBOutlet weak var accountImage: UIImageView!
      @IBOutlet weak var cellView: UIView!
  </code></pre>
  
  <p>Then in <code>cellForRowAt</code> method of table view when I wrote </p>
  
  <pre><code>cell.titleOfAccount.text = "Hello World"
  cell.lastModified.text = "Last Modified: 21 May 2017"
  </code></pre>
  
  <p>and ran the code it crashed with this error.</p>
  
  <blockquote>
    <p>fatal error: unexpectedly found nil while unwrapping an Optional value</p>
  </blockquote>
  
  <p>What I did after searching here and there I went back to <code>tableViewCell</code> class and changed <code>!</code> to <code>?</code> and updated the code in <code>cellForRowAt</code> as:</p>
  
  <pre><code> cell.titleOfAccount?.text = "Hello World"
   cell.lastModified?.text = "Last Modified: 21 May 2017"
  </code></pre>
  
  <p>Now when I ran the program it runs successfully but there is no cell appearing in the <code>tableView</code> and I've also implemented the method:</p>
  
  <pre><code>func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return 3;
      }
  </code></pre>
  
  <p>Here is the full code of my <code>cellForRowAt</code> method:</p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          let cell: AccountsTableViewCell = self.tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as! AccountsTableViewCell
  
          cell.backgroundColor = UIColor.clear
          cell.clipsToBounds = true
  
          cell.cellView.layer.shadowColor = UIColor.black.cgColor
          cell.cellView.layer.shadowOpacity = 1
          cell.cellView.layer.shadowOffset = CGSize.zero
          cell.cellView.layer.shadowRadius = 10
  
          cell.titleOfAccount.text = "Hello World"
          cell.lastModified.text = "Last Modified: 21 May 2017"
          cell.accountImage.image = UIImage(named: "fb")
  
          return cell
      }
  </code></pre>
  
  <p>P.S. I've also added <code>self.tableView.register(AccountsTableViewCell.self, forCellReuseIdentifier: cellReuseIdentifier)</code> in <code>viewDidLoad</code></p>
  
  <p><a href="https://i.stack.imgur.com/yegtB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yegtB.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/D9MOn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/D9MOn.png" alt="enter image description here"></a></p>