title: Swift8 tableview outlet becomes a nil after a popover. fatal error: unexpectedly found nil while unwrapping an Optional value
body: <p>I have a serious problem on the first app I am going to publish to the app store.
  In the app I have an array of object and a table view for them to be shown.
  in the table view I am displaying all of the object's information on the screen.
  In each cell I have a button which opens a popover that I made like this(mention this method is connected to the button that each cell has.)`</p>
  
  <pre><code>    @IBAction func performPopOver(sender: UIButton) {
  
           if let cell = sender.superview!.superview!.superview! as? UITableViewCell {
  
                 var indexPath = tableView.indexPathForCell(cell)!
  
                 currentIndexPath = indexPath.row
  
                 println(indexPath.row)
  
                 var popoverViewController = self.storyboard?.instantiateViewControllerWithIdentifier("Settings") as! UIViewController
  
                 popoverViewController.modalPresentationStyle = .Popover
  
                  popoverViewController.preferredContentSize   = CGSizeMake(130, 75)
  
                 let popoverPresentationViewController = popoverViewController.popoverPresentationController
  
                 popoverPresentationViewController?.permittedArrowDirections = .Right
  
                popoverPresentationViewController?.delegate = self
  
                popoverPresentationViewController?.sourceView = cell.contentView
  
                popoverPresentationViewController?.sourceRect = sender.frame
  
                presentViewController(popoverViewController, animated: true, completion: nil)
  
        }
  
    }
  </code></pre>
  
  <p>I get the cell in this method and set a global variable called currentIndexPath to the index path of the cell the user just pressed.
  then creating the popover in the popover I have a delete button which deletes the item with the currentIndexPath from the list and then reload the data and shows the list without the deleted item. </p>
  
  <p>Here is my popover class:</p>
  
  <pre><code> import UIKit
  
   @IBDesignable class PopoverView: UIViewController {
  
        @IBAction func deleteItem(sender: UIButton) {
  
            self.dismissViewControllerAnimated(true, completion: nil)
  
            if !learningItemsList.isEmpty {
  
                 learningItemsList.removeAtIndex(currentIndexPath)
  
            }
  
            LearningListVC().tableView.reloadData()
  
        }
  </code></pre>
  
  <p>learningItemsList is a global variable with all of the objects the user made.</p>
  
  <p>I get an error at the LearningListVC().tableView.reloadData() 
  which says: </p>
  
  <blockquote>
    <p>fatal error: unexpectedly found nil while unwrapping an Optional value</p>
  </blockquote>
  
  <p>Here is my table view setup code if it matters:</p>
  
  <pre><code>func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
  
      return 1
  
  }
  
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
      if learningItemsList.isEmpty {
  
          self.tableView.contentInset = UIEdgeInsets(top: 10, left: 0, bottom: 0, right: 0)
  
          return 1
  
      }else{
  
          self.tableView.contentInset = UIEdgeInsets(top: 88, left: 0, bottom: 0, right: 0)
  
          return learningItemsList.count
  
      }
  
  }
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      let cell = tableView.dequeueReusableCellWithIdentifier("ResultCell", forIndexPath: indexPath) as! ResultCell
  
      if let learningList = learningItemsList as? [ItemToLearn] {
  
          if learningList.isEmpty {
  
              let cell = tableView.dequeueReusableCellWithIdentifier("NoResultCell", forIndexPath: indexPath) as! UITableViewCell
  
      }else{
  
              if let toDoItem = learningList[indexPath.row] as? ItemToLearn {
  
                  cell.subjectName.text = toDoItem.title
  
                  cell.descriptionLabel.text = toDoItem.description
  
                  cell.dateLabel.text = toDoItem.dateString
  
              }
  
          }
  
      }
  
      return cell
  
  }
  </code></pre>
  
  <p>I guess you already know what my app does from this code but it's alright.
  P.S. I know the structure is not that good.</p>
  
  <p>One last thing, I think that the problem is when my learningListView appears again from the popover window and the table view property doesn't load before the reloadData() call</p>