0

I'm passing data from a module to my detailView but how to I pass this data along to my edit view?

enter image description here

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    if let identifier = segue.identifier{
        switch identifier {
            case "edit view":
                let editTableVC = segue.destinationViewController as! EditTableViewController
                if let indexPath = self.tableView.indexPathForCell(sender as! UITableViewCell){
                    editTableVC.product = productAtIndexPath(indexPath)
                }
            case "detail view":
                let detailTableVC = segue.destinationViewController as! DetailTableViewController
                if let indexPath = self.tableView.indexPathForCell(sender as! UITableViewCell){
                    detailTableVC.product = productAtIndexPath(indexPath)
                }

            default: break
        }
    }
}
josef
  • 255
  • 1
  • 6
  • 14
  • possible duplicate of [Passing Data between View Controllers](http://stackoverflow.com/questions/5210535/passing-data-between-view-controllers) – Ali Beadle May 19 '15 at 17:58
  • What is the problem? – Dejan Skledar May 19 '15 at 18:00
  • my edit table is empty – josef May 19 '15 at 18:01
  • I belive the table cell data is passed to the detail view but the data is not passed to the edit view do to the fact that the table cell that is connected to the segue that leads to the edit view does not contain any data, but how can i store this data in that table cell? – josef May 19 '15 at 18:04
  • Is navigation hapening? – Amit89 May 19 '15 at 18:24
  • yes the navigation is good, but due to the fact that the edit table only connected to the table cell "make a tribute" and that dont contain any data so there is nothing to send. is there anyway I can make the detailTableVC variable indexPath global or avalible from edit view? – josef May 19 '15 at 18:30

0 Answers0