In my swift code code the goal is when a user selects a tableview cell it segues to class Expenset. My code cannot use storyboard only code. You can see in a gif below that my code below is not working.
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@objc func segueAction(_ coder : NSCoder) -> Expenset? {
let vc = Expenset (coder: coder)
guard let indexPath = tableveiew.indexPathForSelectedRow else {
return vc
}
let budget = budgets[indexPath.row]
vc?.budget = budget
tableveiew.deselectRow(at: indexPath, animated: true)
return vc
}
}
class Expenset : ViewController {
var budget : Budget?
private var expenses : [Any] = []
}