I have an array: var initialArray. That appends every time the screen is tapped. This is done on ViewController 3
I have a table which displays the array in another view controller: ViewController2. However the issue is: use of unresolved identifier: initialArray.
How can I get ViewController2 to recall variables from ViewController3?
class ViewController2: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
tableView.delegate = self
tableView.dataSource = self
}
//How many rows
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return initialArray
//////use of unresolved identifier: initialArray
}
//What goes in each cell
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
print(indexPath.row)
cell.textLabel?.text = initialArray[indexPath.row]
//////use of unresolved identifier: initialArray
return cell
}