I'd like to pass my array from my first to my second ViewController. In the end of my first VC I tried to pass it like this:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let secondVC = ViewController2()
secondVC.passengers2 = passengers
print(secondVC.passengers2)
print(passengers)
}
"passengers" is my first array in "ViewController.swift" and "passengers2" my sewcond array in "ViewController2.swift".
When I go over to my second VC, the console tells me, that "passengers" and "passengers2" have the same value, but as soon as I am in "ViewController2.swift", "passengers2" is emtpy for some reason.
Does anyone know why?
let secondVC = segue.destination as ViewController2instead.