34 lines
1.6 KiB
Swift
34 lines
1.6 KiB
Swift
//
|
|
// MoleculeDelegateProtocol.swift
|
|
// MVMCoreUI
|
|
//
|
|
// Created by Suresh, Kamlesh on 11/26/19.
|
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public protocol MoleculeDelegateProtocol {
|
|
|
|
/// returns a module for the corresponding module name.
|
|
func getModuleWithName(_ name: String?) -> [AnyHashable : Any]?
|
|
func getModuleWithName(_ moleculeName: String) -> MoleculeModelProtocol?
|
|
|
|
/// Notifies the delegate that the molecule layout update. Should be called when the layout may change due to an async method.
|
|
func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) //optional
|
|
|
|
/// Asks the delegate to add or remove molecules.
|
|
func getIndexPath(for molecule: ListItemModelProtocol & MoleculeModelProtocol) -> IndexPath?
|
|
func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], indexPath: IndexPath, animation: UITableView.RowAnimation)
|
|
func removeMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], animation: UITableView.RowAnimation)
|
|
}
|
|
|
|
extension MoleculeDelegateProtocol {
|
|
|
|
public func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {}
|
|
|
|
public func getIndexPath(for molecule: ListItemModelProtocol & MoleculeModelProtocol) -> IndexPath? { return nil }
|
|
public func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], indexPath: IndexPath, animation: UITableView.RowAnimation) {}
|
|
public func removeMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], animation: UITableView.RowAnimation) {}
|
|
}
|