Skip to content

Instantly share code, notes, and snippets.

@mhijack
Created April 21, 2021 23:23
Show Gist options
  • Save mhijack/18b496b62d813d41ff6c24ca112a4a09 to your computer and use it in GitHub Desktop.
Save mhijack/18b496b62d813d41ff6c24ca112a4a09 to your computer and use it in GitHub Desktop.
extension EmptyTableView {
func showEmptyCell() {
guard self.emptyDataSource !== self.dataSource else {
reloadData()
return
}
self.delegate = self.emptyTableViewDelegate
self.dataSource = self.emptyDataSource
self.reloadData()
}
func hideEmptyCell() {
guard self.normalDataSource !== self.dataSource else {
reloadData()
return
}
self.delegate = self.normalTableViewDelegate
self.dataSource = self.normalDataSource
self.reloadData()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment