Reputation: 8986
I have two tableView (favouriteViewController and baseViewController) controllers in my project and the ViewController connected through segue. i have some data running in my baseViewController and the favouriteViewController basically with no data in it.i am trying to copy tableViewCell data from baseViewController to favouriteViewController by long pressing tableViewCell or swipe action method.
Thanks in Advance...
Upvotes: 0
Views: 87
Reputation: 2646
You can pass data through segues using the prepareForSegue
method which will allow you to state a destination view controller (in this case a table view controller) and object to receive the data.
You will have to give your segue a name in storyboard by clicking on the link and changing the identifier
field.
Here is an example:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "AddItem") {
let navigationController = segue.destinationViewController as UINavigationController
var controller = navigationController.topViewController as AddItemViewController
controller.delegate = self
}
}
And here is the link to the tutorial this was taken from.
Upvotes: 1