Refresh TableViewController data after adding item

I have tableView (A) responsible for enumerating CoreData items and viewController (B) for adding a new item. To create the user interface of ViewController (B), they decided to use the following Present Modified to use the presentation In the current context to enable a transparent background and be able to apply blur.

  • From TableView (A) click the button to add a new item, the view control (B) appears.
  • Add new item and save it to CoreData li>
  • The viewController (B) function executes self.dismissViewControllerAnimated(true, completion: nil)

    and the display returns to the tableView (B)

The problem is that the table view is not updating the data.

Following a post from Stack Overflow leading to the code:

override func viewDidAppear(animated: Bool) {
    self.loadData()
}

      

But at the back of viewController (B) nothing happens in Xcode not skipping lines viewDidAppear

.

Can anyone help me?

+1


source to share


1 answer


Try the following:



 override func viewDidAppear(animated: Bool)
{
    self.yourTableViewName.reloadData()
}

      

+1


source







All Articles