child molecule fixes

This commit is contained in:
Pfeil, Scott Robert 2021-07-16 17:37:55 -04:00
parent 5a08c88e2c
commit 52a872f95d
4 changed files with 25 additions and 3 deletions

View File

@ -18,7 +18,7 @@ public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, Par
public var rightLabel: LabelModel
public var children: [MoleculeModelProtocol] {
return [image, headlineBody, rightLabel]
[image, headlineBody, rightLabel]
}
//-----------------------------------------------------

View File

@ -91,3 +91,25 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
try container.encodeModelIfPresent(titleView, forKey: .titleView)
}
}
extension NavigationItemModel: ParentMoleculeModelProtocol {
public var children: [MoleculeModelProtocol] {
var children: [MoleculeModelProtocol] = []
if let line = line {
children.append(line)
}
if let titleView = titleView {
children.append(titleView)
}
if let backButton = backButton {
children.append(backButton)
}
if let leftButtons = additionalLeftButtons {
children.append(contentsOf: leftButtons)
}
if let rightButtons = additionalRightButtons {
children.append(contentsOf: rightButtons)
}
return children
}
}

View File

@ -16,7 +16,7 @@
public var moleculeStack: StackModel
public override var rootMolecules: [MoleculeModelProtocol] {
return [header, moleculeStack, footer].compactMap { $0 }
[navigationBar, header, moleculeStack, footer].compactMap { $0 }
}
//--------------------------------------------------

View File

@ -18,7 +18,7 @@
public var footer: MoleculeModelProtocol?
public override var rootMolecules: [MoleculeModelProtocol] {
return [header, footer].compactMap { $0 }
[navigationBar, header, footer].compactMap { $0 }
}
//--------------------------------------------------