forked from organicmaps/organicmaps
Use BMCView protocol methods for insert/delete rows. Also updated BMCView protocol to be more flexible (insert/delete multiple rows)
This commit is contained in:
parent
358471a06c
commit
fe79e12bc2
3 changed files with 10 additions and 10 deletions
iphone/Maps/Bookmarks/Categories
|
@ -160,12 +160,12 @@ extension BMCViewController: BMCView {
|
|||
}
|
||||
}
|
||||
|
||||
func insert(at indexPath: IndexPath) {
|
||||
tableView.insertRows(at: [indexPath], with: .automatic)
|
||||
func insert(at indexPaths: [IndexPath]) {
|
||||
tableView.insertRows(at: indexPaths, with: .automatic)
|
||||
}
|
||||
|
||||
func delete(at indexPath: IndexPath) {
|
||||
tableView.deleteRows(at: [indexPath], with: .automatic)
|
||||
func delete(at indexPaths: [IndexPath]) {
|
||||
tableView.deleteRows(at: indexPaths, with: .automatic)
|
||||
}
|
||||
|
||||
func conversionFinished(success: Bool) {
|
||||
|
@ -310,9 +310,9 @@ extension BMCViewController: BMCPermissionsHeaderDelegate {
|
|||
rowIndexes.append(IndexPath(row: rowIndex, section: sectionIndex))
|
||||
}
|
||||
if (permissionsHeader.isCollapsed) {
|
||||
tableView.deleteRows(at: rowIndexes, with: .automatic)
|
||||
delete(at: rowIndexes)
|
||||
} else {
|
||||
tableView.insertRows(at: rowIndexes, with: .automatic)
|
||||
insert(at: rowIndexes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ extension BMCDefaultViewModel: BMCViewModel {
|
|||
}
|
||||
|
||||
categories.append(BMCCategory(identifier: BM.createCategory(withName: name), title: name))
|
||||
view.insert(at: IndexPath(row: categories.count - 1, section: section))
|
||||
view.insert(at: [IndexPath(row: categories.count - 1, section: section)])
|
||||
}
|
||||
|
||||
func renameCategory(category: BMCCategory, name: String) {
|
||||
|
@ -154,7 +154,7 @@ extension BMCDefaultViewModel: BMCViewModel {
|
|||
|
||||
categories.remove(at: row)
|
||||
BM.deleteCategory(category.identifier)
|
||||
view.delete(at: IndexPath(row: row, section: section))
|
||||
view.delete(at: [IndexPath(row: row, section: section)])
|
||||
}
|
||||
|
||||
func checkCategory(name: String) -> Bool {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
protocol BMCView: AnyObject {
|
||||
func update(sections: [BMCSection])
|
||||
func delete(at indexPath: IndexPath)
|
||||
func insert(at indexPath: IndexPath)
|
||||
func delete(at indexPaths: [IndexPath])
|
||||
func insert(at indexPaths: [IndexPath])
|
||||
func conversionFinished(success: Bool)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue