Changes as per review comments

This commit is contained in:
Sumanth Nadigadda 2021-06-09 23:12:45 +05:30
parent bba4cbfb66
commit 921df032b2
4 changed files with 8 additions and 19 deletions

View File

@ -316,8 +316,8 @@ public typealias ActionBlock = () -> ()
textColor = color.uiColor textColor = color.uiColor
} }
if let numberofLines = labelModel.numberOfLines { if let lines = labelModel.numberOfLines {
numberOfLines = numberofLines numberOfLines = lines
} }
if let attributes = labelModel.attributes, let labelText = text { if let attributes = labelModel.attributes, let labelText = text {
@ -794,6 +794,7 @@ extension Label {
accessibilityCustomActions = [] accessibilityCustomActions = []
clauses = [] clauses = []
accessibilityTraits = .staticText accessibilityTraits = .staticText
numberOfLines = 0
} }
public func needsToBeConstrained() -> Bool { true } public func needsToBeConstrained() -> Bool { true }

View File

@ -25,7 +25,7 @@
public var html: String? public var html: String?
public var hero: Int? public var hero: Int?
public var makeWholeViewClickable: Bool? public var makeWholeViewClickable: Bool?
public var numberOfLines:Int? public var numberOfLines: Int?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Keys // MARK: - Keys
@ -51,24 +51,13 @@
enum AttributeTypeKey: String, CodingKey { enum AttributeTypeKey: String, CodingKey {
case type case type
} }
//-----------------------------------------------------
// MARK: - Methods
//-----------------------------------------------------
internal func setDefaults() {
if numberOfLines == nil {
numberOfLines = 1
}
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializer // MARK: - Initializer
//-------------------------------------------------- //--------------------------------------------------
public init(text: String) { public init(text: String) {
self.text = text self.text = text
setDefaults()
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -55,7 +55,6 @@
leftImage.contentMode = .scaleAspectFit leftImage.contentMode = .scaleAspectFit
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal) rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal)
rightLabel.numberOfLines = 1
addMolecule(stack) addMolecule(stack)
stack.restack() stack.restack()
} }
@ -73,9 +72,6 @@
headlineBody.set(with: model.headlineBody, delegateObject, additionalData) headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
rightLabel.set(with: model.rightLabel, delegateObject, additionalData) rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
updateAccessibilityLabel() updateAccessibilityLabel()
if let numberOfLines = model.rightLabel.numberOfLines{
rightLabel.numberOfLines = numberOfLines
}
} }
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {

View File

@ -29,6 +29,9 @@ public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, Mol
} }
headlineBody.style = .item headlineBody.style = .item
headlineBody.headline?.hero = 0 headlineBody.headline?.hero = 0
if rightLabel.numberOfLines == nil {
rightLabel.numberOfLines = 1
}
} }
//----------------------------------------------------- //-----------------------------------------------------