I am trying to pass data from one view controller to another.... I have a collection view in the first view controller which is populated dynamically with an array and want it so that when an item is clicked... it opens up the second view controller (which I've done) but sends along data (in this case an array)
Ive looked into core data, but after trying to implement it thought it might be a bit "overkill" for such a basic function? (or am i wrong?)
Anyone have any ideas?
Thanks, Dave
prepareForSegueis the best way to do this. You override this in your initial view controller and are passed in aUIStoryboardSeguewhich has asegue.destinationViewControllerwhich you can use to set any data on that controllervar itemViewController = mainStoryboard.instantiateViewControllerWithIdentifier("projectViewController") as UIViewControllerself.presentViewController(itemViewController, animated: true, completion: nil)is there anyway I can pass data similar to the segues? Hi @jeffamaphone, how would I set a property on the target controller from my initial view controller? Thanks, Davelet appDelegate:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate); let context:NSManagedObjectContext = appDelegate.managedObjectContext!; println(appDelegate.test)it works...but is it ok to use the app delegate like this? Thanks