I\'ve been struggling for a few days now with passing an array from my SecondViewController
to my FirstViewController
using Swift.
From my rese
Your code looks fine, use the following prepareforsegue as it helps figure out where the problem could be
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "segueIdInStoryboard" {
if let DVC = segue.destinationViewController as? FirstViewController{
DVC.mySeguedArray = myIncomeArray
} else {
print("Data NOT Passed! destination vc is not set to firstVC")
}
} else { print("Id doesnt match with Storyboard segue Id") }
}
class FirstViewController: UIViewController
{
@IBOutlet weak var textView: UITextView!
var myIncomeArray: [Income]!
var mySeguedArray: [Income]!{
didSet{
myIncomeArray = mySeguedArray //no need to call viewDidLoad
}
}
}