Trying to pass an array between view controllers. I am not sure why as pretty sure that the array has something in it, still when it arrives on the other side it seems to be empty. No errors... just empty.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "segueMapSelection" {
if let destinaton = segue.destination as? MapTableChoiceViewController {
//destinaton.maps = sender as? [SkiMap]
print("size of array before passing it through: ", maps.count)
destinaton.maps = self.maps
}
}
}
@IBAction func SelectDifferentMapButton(_ sender: Any, forEvent event: UIEvent) {
performSegue(withIdentifier: "segueMapSelection", sender: self.maps)
}
On my receiving ViewController I have a
var maps : [ObjectTypeHere]! = []
Any idea what I am doing here? I have left the code commented of the other way I tried. When I tried that it gave an error.
Thanks for your help.