I have a View controller displaying some information (not table views).
I have an update call to a remote server which fills my data base. I would like to completely reload my ViewController after the update call is done.
What should I do?
An UIViewController is just the base class of this already defined "View Controller", you add a viewController as you said, but a viewController has a class associated to it, that can be a UIViewController, UITableViewController, or variations/subclasses.
extension Notification.Name { static let refreshAllTabs = Notification.Name("RefreshAllTabs") } class MainTabBarController: UITabBarController, UITabBarControllerDelegate { override func viewDidLoad() { super. viewDidLoad() NotificationCenter. default. addObserver(forName: .
If you know your database has been updated and you want to just refresh your ViewController (which was my case). I didn't find another solution but what I did was when my database updated, I called:
[self viewDidLoad];
again, and it worked. Remember if you override other viewWillAppear or loadView then call them too in same order. like.
[self viewDidLoad]; [self viewWillAppear:YES];
I think there should be a more specific solution like refresh button in browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With