i have a model class and two tableView Controller. This class in Integer value. This class in value send to other class with prepareforsegue method. But i can not prepareforsegue get tableView indexpath. i' m doing wrong?
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let subCategory: SubCategoryVC = segue.destinationViewController as SubCategoryVC
let indexPath = self.categoryTableView.indexPathForSelectedRow()
model = arrList[indexPath?.row] **//incorrect line**
subCategory.getCatID = model.categoryID
}
yes. i found it. This problem is optional. :(
let indexPath = self.categoryTableView.indexPathForSelectedRow()**!**
I put the exclamation point on the end of the line and correct.
safe method;
if let indexPath = categoryTableView.indexPathForSelectedRow() {
// do the work here
}