1

I am trying to find the solution for how to automatically reload all the data in view controller but i can't find any. Right now i am using push to refresh to reload the button/title/data in view controller viewDidload() but i want to have it automalliy reload everything every time i come back to this viewcontroller. For example when app lunched, it load view controller A then i clicked on the button to go View controller B but i want to controller A to refresh everything after back from B so how can i do that?

Thanks

2
  • viewWillAppear. Commented Mar 13, 2018 at 16:07
  • Insert the refresh methods into the viewWillAppear, it gets called every time the view appears. Commented Mar 13, 2018 at 16:08

1 Answer 1

2

For this, there is a method viewWillAppear

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    reloadData()
}

func reloadData() {
    //All you need to update
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.