Open heightForRowAt delegate method. Add index safety fetch to getMoleculeInfo given optional return.

This commit is contained in:
Hedden, Kyle Matthew 2024-03-25 20:23:38 -04:00
parent 9c36bbf38f
commit 6b2ac01028

View File

@ -140,7 +140,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
}
}
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
open func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return (getMoleculeInfo(for: indexPath)?.molecule as? ListItemModelProtocol)?.gone == true ? 0 : UITableView.automaticDimension
}
@ -289,7 +289,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
/// Returns the (identifier, class) of the molecule for the indexPath.
func getMoleculeInfo(for indexPath: IndexPath) -> MoleculeInfo? {
moleculesInfo?[indexPath.row]
moleculesInfo?[safe: indexPath.row]
}
/// Sets up the molecule list and ensures no errors loading all content.