removed helper methods

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-01-06 15:29:37 -06:00
parent 3db7cf0a42
commit e41812e7c7
4 changed files with 21 additions and 37 deletions

View File

@ -232,8 +232,13 @@ open class Tilet: TileContainer {
if badgeContainerView.superview == nil {
stackView.insertArrangedSubview(badgeContainerView, at: 0)
}
badge.set(with: badgeModel)
badge.text = badgeModel.text
badge.fillColor = badgeModel.fillColor
badge.numberOfLines = badgeModel.numberOfLines
badge.surface = badgeModel.surface
badge.maxWidth = badgeModel.maxWidth
} else {
badge.reset()
badgeContainerView.removeFromSuperview()
}
@ -276,9 +281,14 @@ open class Tilet: TileContainer {
titleLockupTrailingConstraint?.isActive = true
}
titleLockup.set(with: titleModel)
titleLockup.set(with: subTitleModel)
//set models
titleLockup.titleModel = titleModel?.toTitleLockupTitleModel()
titleLockup.subTitleModel = subTitleModel?.toTitleLockupSubTitleModel()
if let style = subTitleModel?.typographicalStyle.value {
titleLockup.otherTypograpicalStyle = style
}
} else {
titleLockupContainerView.removeFromSuperview()
}

View File

@ -21,17 +21,3 @@ public struct TiletBadgeModel {
self.maxWidth = maxWidth
}
}
extension Badge {
public func set(with model: TiletBadgeModel?) {
if let model, !model.text.isEmpty {
text = model.text
fillColor = model.fillColor
numberOfLines = model.numberOfLines
surface = model.surface
maxWidth = model.maxWidth
} else {
reset()
}
}
}

View File

@ -33,16 +33,10 @@ public struct TiletSubTitleModel {
self.textAttributes = textAttributes
self.typographicalStyle = typographicalStyle
}
}
extension TitleLockup {
internal func set(with model: TiletSubTitleModel?) {
if let model, !model.text.isEmpty {
subTitleModel = TitleLockupSubTitleModel(text: model.text, textColor: model.textColor, textAttributes: model.textAttributes)
otherTypograpicalStyle = model.typographicalStyle.value
} else {
subTitleModel = nil
}
}
public func toTitleLockupSubTitleModel() -> TitleLockupSubTitleModel {
TitleLockupSubTitleModel(text: text,
textColor: textColor,
textAttributes: textAttributes)
}
}

View File

@ -32,14 +32,8 @@ public struct TiletTitleModel {
self.textAttributes = textAttributes
self.typographicalStyle = typographicalStyle
}
}
extension TitleLockup {
internal func set(with model: TiletTitleModel?) {
if let model, !model.text.isEmpty {
titleModel = TitleLockupTitleModel(text: model.text, textAttributes: model.textAttributes, typographicalStyle: model.typographicalStyle.value)
} else {
titleModel = nil
}
public func toTitleLockupTitleModel() -> TitleLockupTitleModel {
TitleLockupTitleModel(text: text, textAttributes: textAttributes, typographicalStyle: typographicalStyle.value)
}
}