I am trying to pass a variable through a few different classes to use in core data (one to many relationships).
To give some context of what is happening. I have a tableViewController (jobs), when a user clicks on one of the cells it takes them to a tabBarController with 4 viewControllers. Then on the first viewController is a tableView, if the user clicks on a specific cell it takes them to another tabBarController. I am trying to pass the variable
var job: Job?
from the top level to the final tabBarController but it seems to be getting lost when trying to pass the variable from the first TabBarcontroller to the second tabBarController. I am struggling to see what is wrong to not pass the variable through the ViewControllers.
Here each of the ViewControllers variables and how I am passing them:
JobViewController:
var jobs = [Job]()
// CELL DID SELECT ROW
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let jobTab = jobTabController()
        jobTab.job = jobs[indexPath.row]
        show(jobTab, sender: self)
    }
This is the first tabBarController - jobTabController:
var job: Job?
This is the first ViewController that is attached to jobTabController - jobInfo:
// OBSERVE JOB
var job: Job? {
    let tabBarController = self.tabBarController as! jobTabController
    return tabBarController.job
}
    // CELL DID SELECT ROW
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if indexPath.section == 1 {
            if indexPath.row == 1 {
                let camLens = cameraLensesTabController()
                camLens.job = self.job
                show(camLens, sender: self)
            }
        }
    }
NOTE: This is where the variable seems to get lost - between jobInfo & cameraLensesTabController - name: cameraLensesTabController
var job: Job?
Then this is my viewController that is attached to cameraLensesTabController - cameraController:
var job: Job?
@IBAction func HandleAddCamera(sender : UIButton) {
        let newCamera = newCameraController()
        newCamera.job = self.job
        let navController = UINavigationController(rootViewController: newCamera)
        present(navController, animated: true, completion: nil)
    }
On the cameraController I have an add button that takes you to another ViewController named newCameraController where you can add items to a tableView on cameraController:
var job: Job?
 
     
    