Good afternoon, how to transfer text from a table to another View Controller window.

I can not understand what I did wrong, on the line nextViewController.labelSpecieText = (cell?.textLabel?.text!)! an error:

Value of type 'SpeciesTableViewController' has no member 'labelSpecieText'

Below is the code:

 class SpeciesTableViewController: UITableViewController { var tableData = [String]() override func viewDidLoad() { super.viewDidLoad() let path = NSBundle.mainBundle().pathForResource("SpeciesPets", ofType: "plist") let dict = NSDictionary(contentsOfFile: path!) tableData = dict!.objectForKey("Scpecies") as! [String] } override func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 1 } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return tableData.count } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("CellSpecie", forIndexPath: indexPath) cell.textLabel!.text = tableData[indexPath.row] return cell } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "editNamePat" { if let navController = segue.destinationViewController as? UINavigationController { if let nextViewController = navController.topViewController as? SpeciesTableViewController { let path = tableView.indexPathForSelectedRow let cell = tableView.cellForRowAtIndexPath(path!) nextViewController.labelSpecieText = (cell?.textLabel?.text!)! } } } } } 

Closed due to the fact that off-topic participants Max Mikheyenko , VAndrJ , cheops , aleksandr barakin , Streletz 26 May '16 at 10:01 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Max Mikheyenko, VAndrJ, cheops, aleksandr barakin, Streletz
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 3
    the SpeciesTableViewController class does not have a labelSpecieText variable, judging by the code in the question. - Max Mikheyenko

0