deleted method and refactored atomic label even more

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-03-08 14:03:05 -06:00
parent f0d9664d16
commit dcb5b91e32
2 changed files with 2 additions and 41 deletions

View File

@ -46,14 +46,6 @@ public typealias ActionBlock = () -> ()
return !text.isEmpty || !attributedText.string.isEmpty
}
open override var textColor: UIColor! {
didSet {
if let textColor {
textColorConfiguration = SurfaceColorConfiguration(textColor, textColor).eraseToAnyColorable()
}
}
}
//------------------------------------------------------
// MARK: - Convenience Setter For objective-C
//------------------------------------------------------
@ -229,7 +221,6 @@ public typealias ActionBlock = () -> ()
}
if let style = viewModel.fontStyle?.vdsTextStyle() {
font = style.font
textStyle = style
} else if let fontName = viewModel.fontName {
// there is a TextStyle.defaultStyle
@ -237,9 +228,8 @@ public typealias ActionBlock = () -> ()
if let fontSize {
standardFontSize = fontSize
}
if let customStyle = style(for: fontName, pointSize: fontSize ?? standardFontSize), customStyle != textStyle {
font = customStyle.font
textStyle = customStyle
if let newFont = UIFont(name: fontName, size: fontSize ?? standardFontSize) {
font = newFont
}
}
@ -256,26 +246,6 @@ public typealias ActionBlock = () -> ()
}
}
/// See if the font that is currently set matches a VDS Font and if so grab the matching TextStyle or create custom TextStyle that
/// that the Label will use moving forward.
private func checkforFontChange() {
guard let customStyle = style(for: font.fontName, pointSize: font.pointSize), customStyle != textStyle
else { return }
textStyle = customStyle
}
private func style(for fontName: String, pointSize: CGFloat) -> TextStyle? {
guard let vdsFont = Font.from(fontName: fontName),
let customStyle = TextStyle.style(from: vdsFont, pointSize: pointSize)
else { return nil }
return customStyle
}
open override func updateView() {
checkforFontChange()
super.updateView()
}
open override func updateAccessibility() {
super.updateAccessibility()

View File

@ -54,12 +54,3 @@ extension VDS.Font {
Self.allCases.filter({$0.fontName == fontName }).first
}
}
extension VDS.TextStyle {
internal static func style(from font: VDS.Font, pointSize: CGFloat) -> TextStyle? {
guard let first = allCases.filter({$0.fontFace == font && $0.pointSize == pointSize}).first else {
return TextStyle(rawValue: "Custom-TextStyle", fontFace: font, pointSize: pointSize)
}
return first
}
}