Code cleanup and realigned file structure.
This commit is contained in:
parent
e34e859aa1
commit
0f4c11e2f2
@ -1122,15 +1122,6 @@
|
||||
name = "Recovered References";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA2AD114244EE43900BBFFE3 /* DeviceItems */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */,
|
||||
AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */,
|
||||
);
|
||||
path = DeviceItems;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA4FC2A323F4F69600E251DB /* RightVariable */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1190,6 +1181,8 @@
|
||||
children = (
|
||||
BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */,
|
||||
BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */,
|
||||
AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */,
|
||||
AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */,
|
||||
);
|
||||
path = Device;
|
||||
sourceTree = "<group>";
|
||||
@ -1393,7 +1386,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D20FFFB42451E32100A31DA2 /* Device */,
|
||||
AA2AD114244EE43900BBFFE3 /* DeviceItems */,
|
||||
52267A0523FFE0A900906CBA /* OneColumn */,
|
||||
D22D8396241FDE4700D3DF69 /* TwoColumn */,
|
||||
8DD1E36C243B3CD900D8F2DF /* ThreeColumn */,
|
||||
|
||||
@ -152,7 +152,6 @@ import Foundation
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsage.self, viewModelClass: ListThreeColumnDataUsageModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkMedium.self, viewModelClass: ListDeviceComplexLinkMediumModel.self)
|
||||
|
||||
// Designed Section Dividers
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self)
|
||||
@ -169,9 +168,9 @@ import Foundation
|
||||
// Designed Headers
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self)
|
||||
|
||||
|
||||
// Device Items
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkMedium.self, viewModelClass: ListDeviceComplexLinkMediumModel.self)
|
||||
|
||||
// TODO: Need View
|
||||
try? ModelRegistry.register(TabsModel.self)
|
||||
|
||||
@ -12,23 +12,23 @@ import Foundation
|
||||
//-----------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//-----------------------------------------------------
|
||||
private let stack: Stack<StackModel>
|
||||
public let eyebrow = Label.createLabelRegularMicro(true)
|
||||
public let headline = Label.createLabelBoldTitleMedium(true)
|
||||
public let body = Label.createLabelRegularBodySmall(true)
|
||||
public let body2 = Label.createLabelRegularBodySmall(true)
|
||||
public let link = Link()
|
||||
public let rightImage = MFLoadImageView(pinnedEdges: .all)
|
||||
let leftStack: Stack<StackModel>
|
||||
public let rightImage = MFLoadImageView()
|
||||
let verticalStack: Stack<StackModel>
|
||||
public let stack: Stack<StackModel>
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//------------------------------------------------------
|
||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
leftStack = Stack<StackModel>.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 0)
|
||||
leftStack.stackModel?.molecules[4].spacing = 16
|
||||
rightImage.addSizeConstraintsForAspectRatio = true
|
||||
stack = Stack<StackModel>.createStack(with: [(view: leftStack, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(verticalAlignment: .center))], axis: .horizontal)
|
||||
verticalStack = Stack<StackModel>.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))], axis: .vertical, spacing: 0)
|
||||
|
||||
stack = Stack<StackModel>.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(verticalAlignment: .center))], axis: .horizontal)
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ import Foundation
|
||||
super.setupView()
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
leftStack.restack()
|
||||
verticalStack.restack()
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
@ -52,11 +52,7 @@ import Foundation
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? ListDeviceComplexLinkMediumModel else { return }
|
||||
eyebrow.setOptional(with: model.eyebrow, delegateObject, additionalData)
|
||||
headline.setOptional(with: model.headline, delegateObject, additionalData)
|
||||
body.setOptional(with: model.body, delegateObject, additionalData)
|
||||
body2.setOptional(with: model.body2, delegateObject, additionalData)
|
||||
link.set(with: model.link, delegateObject, additionalData)
|
||||
verticalStack.updateContainedMolecules(with: [model.eyebrow, model.headline, model.body, model.body2, model.link], delegateObject, additionalData)
|
||||
rightImage.set(with: model.image, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
@ -70,6 +66,7 @@ import Foundation
|
||||
headline.styleBoldTitleMedium(true)
|
||||
body.styleRegularBodySmall(true)
|
||||
body2.styleRegularBodySmall(true)
|
||||
eyebrow.textColor = .mvmCoolGray6
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
|
||||
import Foundation
|
||||
public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProtocol {
|
||||
|
||||
public static var identifier: String = "listDvcLnkM"
|
||||
public var eyebrow: LabelModel?
|
||||
public var headline: LabelModel?
|
||||
@ -30,7 +29,6 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto
|
||||
/// Defaults to set
|
||||
override public func setDefaults() {
|
||||
super.setDefaults()
|
||||
eyebrow?.textColor = Color(uiColor: .mvmCoolGray6)
|
||||
if image.width == nil, image.height == nil {
|
||||
image.width = 116
|
||||
image.height = 116
|
||||
@ -49,18 +47,10 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
if let eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow) {
|
||||
self.eyebrow = eyebrow
|
||||
}
|
||||
if let headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline) {
|
||||
self.headline = headline
|
||||
}
|
||||
if let body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body) {
|
||||
self.body = body
|
||||
}
|
||||
if let body2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body2) {
|
||||
self.body2 = body2
|
||||
}
|
||||
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
||||
headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline)
|
||||
body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body)
|
||||
body2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body2)
|
||||
link = try typeContainer.decode(LinkModel.self, forKey: .link)
|
||||
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
|
||||
try super.init(from: decoder)
|
||||
Loading…
Reference in New Issue
Block a user