mvm_core_ui/MVMCoreUI/Molecules/FooterModel.swift
Pfeil, Scott Robert 42b57dcd5d Cleaning
2020-01-21 12:10:48 -05:00

54 lines
1.5 KiB
Swift

//
// FooterModel.swift
// MVMCoreUI
//
// Created by Suresh, Kamlesh on 11/27/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers public class FooterModel: MoleculeContainerModel, MoleculeProtocol {
public static var identifier: String = "footer"
public var backgroundColor: Color?
private enum CodingKeys: String, CodingKey {
case backgroundColor
}
/// Defaults to set
func setDefaults() {
if useHorizontalMargins == nil {
useHorizontalMargins = true
}
if useVerticalMargins == nil {
useVerticalMargins = true
}
if topMarginPadding == nil {
topMarginPadding = PaddingDefaultVerticalSpacing
}
if bottomMarginPadding == nil {
bottomMarginPadding = PaddingDefaultVerticalSpacing
}
}
public override init(with moleculeModel: MoleculeProtocol) {
super.init(with: moleculeModel)
setDefaults()
}
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
try super.init(from: decoder)
setDefaults()
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
}
}