Created
December 3, 2016 04:22
-
-
Save petoye/39b182363bbfefc0916b8b407ce9815c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
func reloadTableData(_ notification: Notification) { | |
tableView.reloadData() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment