ListRightVariableButtonAllTextAndLinks molecule implemented

This commit is contained in:
Damodaram 2020-03-17 16:02:39 +05:30
parent fc741e38df
commit f4f6557c90
3 changed files with 81 additions and 0 deletions

View File

@ -7,3 +7,46 @@
//
import Foundation
@objcMembers open class ListRightVariableButtonAllTextAndLinks: TableViewCell {
//-----------------------------------------------------
// MARK: - Outlets
//-----------------------------------------------------
var stack: Stack<StackModel>
let button = Button(frame: .zero)
let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
// MARK: - Initializers
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 5,horizontalAlignment: .leading)),
(view: button, model: StackItemModel( horizontalAlignment:.fill, verticalAlignment: .top))],axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
//-----------------------------------------------------
// MARK: - View Lifecycle
//-----------------------------------------------------
override open func setupView() {
super.setupView()
addMolecule(stack)
stack.restack()
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRightVariableTextButtonAllTextAndLinksModel else { return }
button.set(with: model.button, delegateObject, additionalData)
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
}
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return 90
}
open override func reset() {
super.reset()
}
}

View File

@ -7,3 +7,40 @@
//
import Foundation
public class ListRightVariableTextButtonAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{
public static var identifier: String = "listRVBtn"
public var button: ButtonModel
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
public init(button: ButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
self.button = button
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
super.init()
}
/// Defaults to set
override public func setDefaults() {
super.setDefaults()
self.button.size = .tiny
}
private enum CodingKeys: String, CodingKey {
case moleculeName
case button
case eyebrowHeadlineBodyLink
}
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
button = try typeContainer.decode(ButtonModel.self, forKey: .button)
eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink)
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(button, forKey: .button)
try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink)
}
}

View File

@ -103,6 +103,7 @@ import Foundation
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableTextButtonAllTextAndLinksModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self)