I am trying to take these variables from one of my view controller's swift file:
//global let choice1Box1 = drivingGear[chooseDrivingGear.selectedRow(inComponent: 0)] let choice2Box1 = drivingGear[chooseDrivenGear1.selectedRow(inComponent: 0)] This is whats being done to the variables in the original class:
@IBAction func showResultBox1(_ sender: Any) { let choice1Box1 = self.drivingGear[self.chooseDrivingGear.selectedRow(inComponent: 0)] let choice2Box1 = self.drivingGear[self.chooseDrivenGear1.selectedRow(inComponent: 0)] if let intVal1 = Double(choice1Box1), let intVal2 = Double(choice2Box1) { result = intVal2 / intVal1 let newLabel = String(result) resultBox1.setTitle(newLabel, for: .normal) } }
Delegateand also you can use prepare(forSegue:) method. matteomanferdini.com/…