Code changes as per review comment.
This commit is contained in:
parent
0256ede110
commit
25ce6b285f
@ -14,30 +14,22 @@ import Foundation
|
||||
//-------------------------------------------------------
|
||||
public var title = Label(fontStyle: .RegularMicro)
|
||||
public var topLeftHeadlineBody = HeadlineBody()
|
||||
public var bottomLeftHeadlineBody = HeadlineBody()
|
||||
public var verticalStack1: Stack<StackModel>
|
||||
public var topCenterHeadlineBody = HeadlineBody()
|
||||
public var bottomCenterHeadlineBody = HeadlineBody()
|
||||
public var verticalStack2: Stack<StackModel>
|
||||
public var topRightHeadlineBody = HeadlineBody()
|
||||
public var tophorizontalStack: Stack<StackModel>
|
||||
public var bottomLeftHeadlineBody = HeadlineBody()
|
||||
public var bottomCenterHeadlineBody = HeadlineBody()
|
||||
public var bottomRightHeadlineBody = HeadlineBody()
|
||||
public var verticalStack3: Stack<StackModel>
|
||||
public var horizontalStack: Stack<StackModel>
|
||||
public var bottomhorizontalStack: Stack<StackModel>
|
||||
public var stack: Stack<StackModel>
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//------------------------------------------------------
|
||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
|
||||
verticalStack1 = Stack<StackModel>.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical)
|
||||
verticalStack2 = Stack<StackModel>.createStack(with: [(view: topCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical)
|
||||
verticalStack3 = Stack<StackModel>.createStack(with: [(view: topRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical)
|
||||
horizontalStack = Stack<StackModel>.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 37, horizontalAlignment: .leading)),
|
||||
(view: verticalStack2, model: StackItemModel(percent: 33, horizontalAlignment: .leading)),
|
||||
(view: verticalStack3, model: StackItemModel(percent: 30, horizontalAlignment: .leading))],
|
||||
axis: .horizontal)
|
||||
stack = Stack<StackModel>.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: horizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 2)
|
||||
tophorizontalStack = Stack<StackModel>.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: topCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: topRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal)
|
||||
bottomhorizontalStack = Stack<StackModel>.createStack(with: [(view: bottomLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: bottomCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: bottomRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal)
|
||||
stack = Stack<StackModel>.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: tophorizontalStack, model: StackItemModel(spacing: 2, horizontalAlignment: .leading)), (view: bottomhorizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical)
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
}
|
||||
|
||||
@ -53,10 +45,8 @@ import Foundation
|
||||
title.numberOfLines = 1
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
verticalStack1.restack()
|
||||
verticalStack2.restack()
|
||||
verticalStack3.restack()
|
||||
horizontalStack.restack()
|
||||
tophorizontalStack.restack()
|
||||
bottomhorizontalStack.restack()
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -66,9 +56,8 @@ import Foundation
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? ListThreeColumnSpeedTestModel else { return }
|
||||
title.set(with: model.title, delegateObject, additionalData)
|
||||
verticalStack1.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.bottomLeftHeadlineBody], delegateObject, additionalData)
|
||||
verticalStack2.updateContainedMolecules(with: [model.topCenterHeadlineBody, model.bottomCenterHeadlineBody], delegateObject, additionalData)
|
||||
verticalStack3.updateContainedMolecules(with: [model.topRightHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData)
|
||||
tophorizontalStack.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.topCenterHeadlineBody, model.topRightHeadlineBody], delegateObject, additionalData)
|
||||
bottomhorizontalStack.updateContainedMolecules(with: [model.bottomLeftHeadlineBody, model.bottomCenterHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData)
|
||||
updateAccessibilityLabel()
|
||||
}
|
||||
|
||||
@ -79,24 +68,12 @@ import Foundation
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
title.setFontStyle(.BoldBodySmall)
|
||||
styleHeadlineBody(topLeftHeadlineBody, true)
|
||||
styleHeadlineBody(bottomLeftHeadlineBody, false)
|
||||
styleHeadlineBody(topCenterHeadlineBody, false)
|
||||
styleHeadlineBody(bottomCenterHeadlineBody, false)
|
||||
styleHeadlineBody(topRightHeadlineBody, false)
|
||||
styleHeadlineBody(bottomRightHeadlineBody, false)
|
||||
}
|
||||
|
||||
//Method to style headline label and message label of HeadlineBody
|
||||
func styleHeadlineBody(_ headlineBody: HeadlineBody, _ isBodyMicro: Bool) {
|
||||
headlineBody.headlineLabel.setFontStyle(.RegularMicro)
|
||||
headlineBody.headlineLabel.textColor = .mvmCoolGray6
|
||||
headlineBody.messageLabel.setFontStyle(.RegularBodySmall)
|
||||
if isBodyMicro {
|
||||
headlineBody.messageLabel.setFontStyle(.RegularMicro)
|
||||
headlineBody.messageLabel.textColor = .mvmCoolGray6
|
||||
}
|
||||
headlineBody.spaceBetweenLabelsConstant = 2
|
||||
topLeftHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||
topCenterHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||
topRightHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||
bottomLeftHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||
bottomCenterHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||
bottomRightHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -35,6 +35,30 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol
|
||||
super.init()
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Method
|
||||
//------------------------------------------------------
|
||||
override public func setDefaults() {
|
||||
styleHeadlineBody(topLeftHeadlineBody, true)
|
||||
styleHeadlineBody(bottomLeftHeadlineBody, false)
|
||||
styleHeadlineBody(topCenterHeadlineBody, false)
|
||||
styleHeadlineBody(bottomCenterHeadlineBody, false)
|
||||
styleHeadlineBody(topRightHeadlineBody, false)
|
||||
styleHeadlineBody(bottomRightHeadlineBody, false)
|
||||
super.setDefaults()
|
||||
}
|
||||
|
||||
//Method to style headline and body of HeadlineBody
|
||||
func styleHeadlineBody(_ headlineBodyModel: HeadlineBodyModel, _ isBodyMicro: Bool) {
|
||||
headlineBodyModel.headline?.fontStyle = .RegularMicro
|
||||
headlineBodyModel.headline?.textColor = Color(uiColor: .mvmCoolGray6)
|
||||
headlineBodyModel.body?.fontStyle = .RegularBodySmall
|
||||
if isBodyMicro {
|
||||
headlineBodyModel.body?.fontStyle = .RegularMicro
|
||||
headlineBodyModel.body?.textColor = Color(uiColor: .mvmCoolGray6)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
//--------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user