index path update
This commit is contained in:
parent
e48a0e3af9
commit
c96e2fa3c2
@ -31,9 +31,10 @@ extension MFViewController: MoleculeDelegateProtocol {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) { }
|
// These are required because swift will call the extension function otherwise.
|
||||||
|
@objc public func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {}
|
||||||
|
|
||||||
@objc public func addMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) { }
|
@objc public func addMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {}
|
||||||
|
@objc public func addMolecules(_ molecules: [[AnyHashable : Any]], indexPath: IndexPath, animation: UITableView.RowAnimation) {}
|
||||||
@objc public func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) { }
|
@objc public func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,8 @@ public protocol MoleculeDelegateProtocol {
|
|||||||
/// Asks the delegate to add or remove molecules.
|
/// Asks the delegate to add or remove molecules.
|
||||||
//optional
|
//optional
|
||||||
func addMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
func addMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
||||||
|
func addMolecules(_ molecules: [[AnyHashable : Any]], indexPath: IndexPath, animation: UITableView.RowAnimation)
|
||||||
|
|
||||||
func removeMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
func removeMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
||||||
|
|
||||||
//optional
|
//optional
|
||||||
@ -36,6 +38,10 @@ extension MoleculeDelegateProtocol {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func addMolecules(_ molecules: [[AnyHashable : Any]], indexPath: IndexPath, animation: UITableView.RowAnimation) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
public func removeMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
public func removeMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|||||||
@ -178,8 +178,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func addMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
open override func addMolecules(_ molecules: [[AnyHashable : Any]], indexPath: IndexPath, animation: UITableView.RowAnimation) {
|
||||||
|
|
||||||
var tmpMolecules = [ListItemModelProtocol & MoleculeModelProtocol]()
|
var tmpMolecules = [ListItemModelProtocol & MoleculeModelProtocol]()
|
||||||
|
|
||||||
molecules.forEach { molecule in
|
molecules.forEach { molecule in
|
||||||
@ -189,7 +188,6 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
guard let indexPath = self.tableView?.indexPath(for: sender) else { return }
|
|
||||||
var indexPaths: [IndexPath] = []
|
var indexPaths: [IndexPath] = []
|
||||||
|
|
||||||
for molecule in tmpMolecules {
|
for molecule in tmpMolecules {
|
||||||
@ -207,6 +205,16 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func addMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
||||||
|
|
||||||
|
DispatchQueue.main.async { [weak self] in
|
||||||
|
guard let indexPath = self?.tableView?.indexPath(for: sender) else { return }
|
||||||
|
DispatchQueue.global().async {
|
||||||
|
self?.addMolecules(molecules, indexPath: indexPath, animation: animation)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
open override func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
open override func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
||||||
|
|
||||||
var tmpMolecules = [ListItemModelProtocol & MoleculeModelProtocol]()
|
var tmpMolecules = [ListItemModelProtocol & MoleculeModelProtocol]()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user