title: Swift prepareForSegue object is nil
body: <p>I'm trying to pass the event Object into DetailViewController, but it crashes and says: "fatal error: unexpectedly found nil while unwrapping an Optional value". I'm positive the error is in my prepare(for segue:) function, but I've been at this for hours and I can't find out how to fix it. Any help would be appreciated. Thanks!</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class MainViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
  
  @IBOutlet weak var textView: UITextView!
  @IBOutlet weak var tableView: UITableView!
  
  var events = [Event]()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
  
  
      tableView.delegate = self
      tableView.dataSource = self
  
      parseCSV()
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  
  @IBAction func logOutAction(sender: AnyObject) {
      if FIRAuth.auth()?.currentUser != nil {
          do {
              try FIRAuth.auth()?.signOut()
              let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SignUp")
              present(vc, animated: true, completion: nil)
  
          } catch let error as NSError {
              print(error.localizedDescription)
          }
      }
  }
  
  func parseCSV() {
      let path = Bundle.main.path(forResource: "eventData", ofType: "csv")
      do {
          let csv = try CSV(contentsOfURL: path!)
          let rows = csv.rows
  
          for row in rows {
              let eventTitle = row["Title "]!
              let eventLoc = row[" Location "]!
              let eventStart = row[" Start_Time "]!
              let eventEnd = row [" End_Time"]!
  
              let event = Event(title: eventTitle, loc: eventLoc, start: eventStart, end: eventEnd)
              events.append(event)
          }
      } catch let err as NSError {
          print(err.debugDescription)
      }
  }
  
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      if let cell = tableView.dequeueReusableCell(withIdentifier: "eventCell", for: indexPath) as? EventCell{
          let event = events[indexPath.row]
          cell.updateUI(event: event)
  
          return cell
      } else {
          return UITableViewCell()
      }
  }
  
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return events.count
  }
  
  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      let event = events[indexPath.row]
      performSegue(withIdentifier: "detailSegue", sender: event)
  }
  
  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      if segue.identifier == "detailSeque" {
          if let detailVC = segue.destination as? DetailViewController {
              if let event = sender as? Event {
                  detailVC.event = event
              }
          }
      }
  }
  }
  </code></pre>
  
  <p>My DetailViewController class:</p>
  
  <pre><code>class DetailViewController: UIViewController {
  
  var event: Event!
  
  @IBOutlet weak var eventTitle: UILabel!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      eventTitle.text = event.title // error here. says event is nil.
      }
  }
  </code></pre>