color changes

This commit is contained in:
Scott Pfeil 2022-09-19 13:53:53 -04:00
parent dcd4dde59d
commit 2ad329949a
3 changed files with 12 additions and 1 deletions

View File

@ -72,7 +72,11 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
override open func viewForBottom() -> UIView { override open func viewForBottom() -> UIView {
guard let footerModel = templateModel?.footer, guard let footerModel = templateModel?.footer,
let molecule = generateMoleculeView(from: footerModel) let molecule = generateMoleculeView(from: footerModel)
else { return super.viewForBottom() } else {
let view = super.viewForBottom()
view.backgroundColor = templateModel?.footerColor?.uiColor ?? .clear
return view
}
return molecule return molecule
} }

View File

@ -16,6 +16,7 @@
public var header: MoleculeModelProtocol? public var header: MoleculeModelProtocol?
public var anchorFooter: Bool = false public var anchorFooter: Bool = false
public var footer: MoleculeModelProtocol? public var footer: MoleculeModelProtocol?
public var footerColor = Color(name: "white")
public override var rootMolecules: [MoleculeModelProtocol] { public override var rootMolecules: [MoleculeModelProtocol] {
[navigationBar, header, footer].compactMap { $0 } [navigationBar, header, footer].compactMap { $0 }
@ -38,6 +39,7 @@
case header case header
case anchorFooter case anchorFooter
case footer case footer
case footerColor
} }
//-------------------------------------------------- //--------------------------------------------------
@ -54,6 +56,9 @@
anchorFooter = anchor anchorFooter = anchor
} }
footer = try typeContainer.decodeModelIfPresent(codingKey: .footer) footer = try typeContainer.decodeModelIfPresent(codingKey: .footer)
if let footerColor = try typeContainer.decodeIfPresent(Color.self, forKey: .footerColor) {
self.footerColor = footerColor
}
try super.init(from: decoder) try super.init(from: decoder)
} }
@ -64,5 +69,6 @@
try container.encodeModelIfPresent(header, forKey: .header) try container.encodeModelIfPresent(header, forKey: .header)
try container.encodeIfPresent(anchorFooter, forKey: .anchorFooter) try container.encodeIfPresent(anchorFooter, forKey: .anchorFooter)
try container.encodeModelIfPresent(footer, forKey: .footer) try container.encodeModelIfPresent(footer, forKey: .footer)
try container.encodeIfPresent(footerColor, forKey: .footerColor)
} }
} }

View File

@ -169,6 +169,7 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
bottomView = MVMCoreUICommonViewsUtility.getView(with: 0.5) bottomView = MVMCoreUICommonViewsUtility.getView(with: 0.5)
} }
let footerView = MVMCoreUICommonViewsUtility.commonView() let footerView = MVMCoreUICommonViewsUtility.commonView()
footerView.backgroundColor = bottomView.backgroundColor
footerView.addSubview(bottomView) footerView.addSubview(bottomView)
bottomViewTopConstraint = bottomView.topAnchor.constraint(equalTo: footerView.topAnchor, constant: spaceAboveBottomView() ?? 0) bottomViewTopConstraint = bottomView.topAnchor.constraint(equalTo: footerView.topAnchor, constant: spaceAboveBottomView() ?? 0)
bottomViewTopConstraint?.isActive = true bottomViewTopConstraint?.isActive = true