guard tableview added in tabledirector extension

This commit is contained in:
nikAshanin 2017-04-10 18:21:39 +03:00
parent 3937622881
commit cc3b3bfed7
1 changed files with 7 additions and 3 deletions

View File

@ -56,10 +56,14 @@ public extension TableDirector {
@discardableResult
public func reload(sectionAtIndex index: Int, with animation: UITableViewRowAnimation = .none) -> Self {
let action = { [tableView] in
if index < tableView?.numberOfSections ?? 0 {
tableView?.reloadSections([index], with: animation)
guard let tableView = tableView else {
return
}
if index < tableView.numberOfSections {
tableView.reloadSections([index], with: animation)
} else {
tableView?.reloadData()
tableView.reloadData()
}
}
if animation == .none {