Changes as per review comments - Default 'numberOfLines' for all Designed components

This commit is contained in:
Sumanth Nadigadda 2021-06-22 17:27:41 +05:30
parent 921df032b2
commit f09892b4c6
18 changed files with 90 additions and 15 deletions

View File

@ -48,11 +48,8 @@ import Foundation
open override func setupView() {
super.setupView()
setDefaults()
body.numberOfLines = 1
body.lineBreakMode = .byTruncatingTail
body2.numberOfLines = 1
body2.lineBreakMode = .byTruncatingTail
body3.numberOfLines = 1
body3.lineBreakMode = .byTruncatingTail
verticalLine1.widthConstraint?.isActive = true

View File

@ -21,6 +21,23 @@ public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol {
public var body3: LabelModel
public var subBody3: LabelModel?
//-----------------------------------------------------
// MARK: - Methods
//-----------------------------------------------------
override public func setDefaults() {
super.setDefaults()
if body.numberOfLines == nil {
body.numberOfLines = 1
}
if body2.numberOfLines == nil {
body2.numberOfLines = 1
}
if body3.numberOfLines == nil {
body3.numberOfLines = 1
}
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------

View File

@ -50,7 +50,6 @@
leftImage.contentMode = .scaleAspectFit
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.numberOfLines = 1
addMolecule(stack)
stack.restack()
}

View File

@ -31,6 +31,10 @@ public class ListLeftVariableIconWithRightCaretAllTextLinksModel: ListItemModel,
image.width = 30
image.height = 30
}
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
}
//-----------------------------------------------------

View File

@ -71,7 +71,6 @@
rightBar.widthAnchor.constraint(equalToConstant: 20).isActive = true
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.numberOfLines = 1
addMolecule(stack)
stack.restack()
horizontalStack.restack()

View File

@ -45,6 +45,10 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol {
rightBar.backgroundColor = Color(uiColor: .gray)
}
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
leftHeadline.hero = 0
}

View File

@ -39,7 +39,6 @@
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.numberOfLines = 1
addMolecule(stack)
stack.restack()
horizontalStack.restack()

View File

@ -18,6 +18,17 @@ public class ListStoreLocatorModel: ListItemModel, MoleculeModelProtocol {
public var leftSubBody: LabelModel
public var rightLabel: LabelModel
//-----------------------------------------------------
// MARK: - Methods
//-----------------------------------------------------
override public func setDefaults() {
super.setDefaults()
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------

View File

@ -61,7 +61,6 @@
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.numberOfLines = 1
addMolecule(stack)
stack.restack()
}

View File

@ -17,6 +17,17 @@ public class ListRightVariablePriceChangeAllTextAndLinksModel: ListItemModel, Mo
public var rightLabel: LabelModel
public var arrow: ArrowModel
//-----------------------------------------------------
// MARK: - Methods
//-----------------------------------------------------
override public func setDefaults() {
super.setDefaults()
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------

View File

@ -46,7 +46,6 @@
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.numberOfLines = 1
addMolecule(stack)
stack.restack()

View File

@ -37,6 +37,9 @@ public class ListRightVariablePriceChangeBodyTextModel: ListItemModel, MoleculeM
if let headline = headlineBody.headline {
headline.hero = 0
}
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
}
//--------------------------------------------------

View File

@ -38,7 +38,6 @@
super.setupView()
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.numberOfLines = 1
addMolecule(stack)
stack.restack()
}

View File

@ -16,6 +16,17 @@ public class ListRightVariableRightCaretAllTextAndLinksModel: ListItemModel, Mol
public var rightLabel: LabelModel
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
//-----------------------------------------------------
// MARK: - Methods
//-----------------------------------------------------
override public func setDefaults() {
super.setDefaults()
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------

View File

@ -39,9 +39,6 @@
open override func setupView() {
super.setupView()
leftLabel.numberOfLines = 1
centerLabel.numberOfLines = 1
rightLabel.numberOfLines = 1
addMolecule(stack)
stack.restack()
}

View File

@ -17,6 +17,23 @@ public class ListThreeColumnBillChangesModel: ListItemModel, MoleculeModelProtoc
public var centerLabel: LabelModel
public var rightLabel: LabelModel
//-----------------------------------------------------
// MARK: - Methods
//-----------------------------------------------------
override public func setDefaults() {
super.setDefaults()
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
if centerLabel.numberOfLines == nil {
centerLabel.numberOfLines = 1
}
if leftLabel.numberOfLines == nil {
leftLabel.numberOfLines = 1
}
}
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------

View File

@ -74,9 +74,6 @@
view.addSubview(rightVerticalStack)
NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true)
leftHeadline.numberOfLines = 1
rightLabel.numberOfLines = 1
rightSubLabel.numberOfLines = 1
}
//----------------------------------------------------

View File

@ -34,6 +34,18 @@ public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelPro
if rightSubLabel.attributes == nil {
rightSubLabel.attributes = [LabelAttributeStrikeThroughModel(0, rightSubLabel.text.count)]
}
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
if rightSubLabel.numberOfLines == nil {
rightSubLabel.numberOfLines = 1
}
if leftHeadline.numberOfLines == nil {
leftHeadline.numberOfLines = 1
}
}
//--------------------------------------------------