Story - 19072: List - Right Variable - Payments Initial Commit
Added Molecule Class, Model Class
This commit is contained in:
parent
c163e963d2
commit
a87926a810
@ -123,6 +123,8 @@
|
||||
94F217B723E0BF6100A47C06 /* PrimaryButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */; };
|
||||
94FB966223D797DA003D482B /* MFTextButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94FB966023D797DA003D482B /* MFTextButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; };
|
||||
AA11A41F23F15D3100D7962F /* RightVariablePaymentsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */; };
|
||||
AA11A42123F15D7000D7962F /* RightVariablePaymentsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.swift */; };
|
||||
C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; };
|
||||
C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; };
|
||||
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; };
|
||||
@ -439,6 +441,8 @@
|
||||
94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrimaryButtonView.m; sourceTree = "<group>"; };
|
||||
94FB966023D797DA003D482B /* MFTextButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFTextButton.h; sourceTree = "<group>"; };
|
||||
94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = "<group>"; };
|
||||
AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RightVariablePaymentsList.swift; sourceTree = "<group>"; };
|
||||
AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RightVariablePaymentsListModel.swift; sourceTree = "<group>"; };
|
||||
C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
|
||||
C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = "<group>"; };
|
||||
C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = "<group>"; };
|
||||
@ -897,6 +901,8 @@
|
||||
D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */,
|
||||
01509D902327ECE600EF99AA /* CornerLabels.swift */,
|
||||
D224798823142BF2003FCCF9 /* ToggleMolecules */,
|
||||
AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */,
|
||||
AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.swift */,
|
||||
);
|
||||
path = LeftRightViews;
|
||||
sourceTree = "<group>";
|
||||
@ -1556,6 +1562,7 @@
|
||||
DBC4391922442197001AB423 /* DashLine.swift in Sources */,
|
||||
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */,
|
||||
D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */,
|
||||
AA11A41F23F15D3100D7962F /* RightVariablePaymentsList.swift in Sources */,
|
||||
D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */,
|
||||
0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */,
|
||||
017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */,
|
||||
@ -1617,6 +1624,7 @@
|
||||
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
||||
0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */,
|
||||
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
|
||||
AA11A42123F15D7000D7962F /* RightVariablePaymentsListModel.swift in Sources */,
|
||||
01EB369223609801006832FA /* MoleculeStackModel.swift in Sources */,
|
||||
012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */,
|
||||
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
|
||||
|
||||
@ -0,0 +1,106 @@
|
||||
//
|
||||
// RightVariablePaymentsList.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Lekshmi S on 10/02/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers public class RightVariablePaymentsList : TableViewCell {
|
||||
|
||||
//-----------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//-------------------------------------------------------
|
||||
|
||||
let leftLabel = Label.commonLabelB2(true)
|
||||
let rightImage = MFLoadImageView()
|
||||
let containerView = ViewConstrainingView()
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//------------------------------------------------------
|
||||
|
||||
let cellHeight: CGFloat = 65.0
|
||||
let leftPadding: CGFloat = 35.0
|
||||
let rightPadding: CGFloat = 54.0
|
||||
let spaceBetweenLabelAndImage: CGFloat = 40.0
|
||||
let imageWidth: CGFloat = 56.0
|
||||
let imageHeight: CGFloat = 16.0
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Initialization
|
||||
//--------------------------------------------------------
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
setupView()
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
setupView()
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// MARK: - View Lifecycle
|
||||
//-------------------------------------------------------
|
||||
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
containerView.updateView(size)
|
||||
leftLabel.updateView(size)
|
||||
rightImage.updateView(size)
|
||||
}
|
||||
|
||||
override open func setupView() {
|
||||
super.setupView()
|
||||
guard leftLabel.superview == nil else {
|
||||
return
|
||||
}
|
||||
|
||||
containerView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.heightAnchor.constraint(equalToConstant: cellHeight).isActive = true
|
||||
contentView.addSubview(containerView)
|
||||
containerView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||
containerView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true
|
||||
containerView.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
||||
containerView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
|
||||
|
||||
containerView.addSubview(leftLabel)
|
||||
containerView.addSubview(rightImage)
|
||||
|
||||
leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor,constant: leftPadding).isActive = true
|
||||
leftLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true
|
||||
leftLabel.bottomAnchor.constraint(equalTo: containerView.bottomAnchor).isActive = true
|
||||
|
||||
rightImage.leadingAnchor.constraint(equalTo: leftLabel.leadingAnchor,constant: spaceBetweenLabelAndImage).isActive = true
|
||||
rightImage.centerYAnchor.constraint(equalTo: leftLabel.centerYAnchor).isActive = true
|
||||
rightImage.widthAnchor.constraint(equalToConstant: imageWidth).isActive = true
|
||||
rightImage.heightAnchor.constraint(equalToConstant: imageHeight).isActive = true
|
||||
containerView.trailingAnchor.constraint(equalTo: rightImage.trailingAnchor,constant: rightPadding).isActive = true
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// MARK: - Molecule
|
||||
//------------------------------------------------------
|
||||
|
||||
override open func reset() {
|
||||
super.reset()
|
||||
|
||||
leftLabel.reset()
|
||||
rightImage.reset()
|
||||
}
|
||||
|
||||
open func setAsMolecule() {
|
||||
setupView()
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? RightVariablePaymentsListModel else { return}
|
||||
leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData)
|
||||
rightImage.setWithModel(model.image, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
//
|
||||
// RightVariablePaymentsListModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Lekshmi S on 10/02/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public class RightVariablePaymentsListModel: ContainerModel, ListItemModelProtocol {
|
||||
|
||||
public var line: LineModel?
|
||||
public var hideArrow: Bool?
|
||||
public var backgroundColor: Color?
|
||||
public var action: ActionModelProtocol?
|
||||
|
||||
public static var identifier: String = "listRVImg"
|
||||
public var image: ImageViewModel
|
||||
public var leftLabel: LabelModel
|
||||
|
||||
func setDefaults() {
|
||||
if useHorizontalMargins == nil {
|
||||
useHorizontalMargins = true
|
||||
}
|
||||
if useVerticalMargins == nil {
|
||||
useVerticalMargins = true
|
||||
}
|
||||
if topMarginPadding == nil {
|
||||
topMarginPadding = 24
|
||||
}
|
||||
if bottomMarginPadding == nil {
|
||||
bottomMarginPadding = 0
|
||||
}
|
||||
}
|
||||
|
||||
public init(image: ImageViewModel, leftLabel: LabelModel) {
|
||||
self.image = image
|
||||
self.leftLabel = leftLabel
|
||||
super.init()
|
||||
setDefaults()
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case leftLabel
|
||||
case image
|
||||
case action
|
||||
case hideArrow
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)
|
||||
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow)
|
||||
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.encode(RightVariablePaymentsListModel.identifier, forKey: .moleculeName)
|
||||
try container.encode(leftLabel, forKey: .leftLabel)
|
||||
try container.encode(image, forKey: .image)
|
||||
try container.encodeModelIfPresent(action, forKey: .action)
|
||||
try container.encodeIfPresent(hideArrow, forKey: .hideArrow)
|
||||
}
|
||||
|
||||
}
|
||||
@ -70,6 +70,7 @@ import Foundation
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RightVariablePaymentsList.self, viewModelClass: RightVariablePaymentsListModel.self)
|
||||
|
||||
// List items
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: ListItemModel.self)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user