Could not cast value of type 'TableViewController' to 'TableViewController'
<p>I'm trying to pass Realm data from Custom cell to Detail TableView Controller </p>

<pre><code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "viewTask" {
        let nextViewController = segue.destinationViewController as!  TaskViewTableViewController
        let indexPath : NSIndexPath = self.tableView?.indexPathForSelectedRow as NSIndexPath!
        let task = tasks![indexPath.row]
        nextViewController.name = task.name
        nextViewController.notes = task.notes
        nextViewController.date = task.date
        nextViewController.timeLength = task.timeLength
    }
}
</code></pre>

<p>I'm getting error </p>

<blockquote>
  <p>Could not cast value of type 'Taskio.TaskListTableViewController'
  (0x10001f028) to 'Taskio.TaskViewTableViewController' (0x10001f280).</p>
</blockquote>

<p><strong>Also tried</strong></p>

<pre><code>   override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue.identifier == "viewTask" {
            let nav = segue.destinationViewController as! UINavigationController
            let nextViewController = segue.destinationViewController as!  TaskViewTableViewController
            let indexPath : NSIndexPath = self.tableView?.indexPathForSelectedRow as NSIndexPath!
            let task = tasks![indexPath.row]
            nextViewController.name = task.name
            nextViewController.notes = task.notes
            nextViewController.date = task.date
            nextViewController.timeLength = task.timeLength
        }
    }
</code></pre>

<p><strong>and also</strong></p>

<pre><code>let nextViewController :  TaskViewTableViewController = segue.destinationViewController as!  TaskViewTableViewController
</code></pre>

<p><strong>EDIT</strong></p>

<p>Forgot to put class name into storyboard of tableViewController. It's <strong>working</strong></p>