Xcode 9 • Swift 4
Create a Notification Name:
extension Notification.Name {
static let reload = Notification.Name("reload")
}
You can post a notification
NotificationCenter.default.post(name: .reload, object: nil)
And add an observer at the view controller that you want to reload the data:
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(reloadTableData), name: .reload, object: nil)
}
@objc func reloadTableData(_ notification: Notification) {
tableView.reloadData()
}