From 5694095aa4dd9acf2dbae24dff59bbfe0be4805c Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 22 Sep 2022 16:59:30 -0500 Subject: [PATCH] added linebreakMode to paragraph style made textColorConfiguration a public property and set it Signed-off-by: Matt Bruce --- VDS/Components/Label/Label.swift | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 0e6c037d..93eb5754 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -67,14 +67,12 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- - private var textColorConfiguration: DisabledSurfaceColorConfiguration = { - return DisabledSurfaceColorConfiguration().with { - $0.disabled.lightColor = VDSColor.elementsSecondaryOnlight - $0.disabled.darkColor = VDSColor.elementsSecondaryOndark - $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight - $0.enabled.darkColor = VDSColor.elementsPrimaryOndark - } - } () + public var textColorConfiguration = DisabledSurfaceColorConfiguration().with { + $0.disabled.lightColor = VDSColor.elementsSecondaryOnlight + $0.disabled.darkColor = VDSColor.elementsSecondaryOndark + $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight + $0.enabled.darkColor = VDSColor.elementsPrimaryOndark + } //-------------------------------------------------- // MARK: - Initializers @@ -100,7 +98,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt super.init(coder: coder) initialSetup() } - + //-------------------------------------------------- // MARK: - Public Functions //-------------------------------------------------- @@ -127,14 +125,14 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt accessibilityTraits = .staticText numberOfLines = 0 } - + //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- open func updateView(viewModel: ModelType) { textAlignment = viewModel.textPosition.textAlignment textColor = textColorConfiguration.getColor(viewModel) - + if let vdsFont = viewModel.font { font = vdsFont } else { @@ -200,6 +198,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt $0.maximumLineHeight = lineHeight $0.minimumLineHeight = lineHeight $0.alignment = viewModel.textPosition.textAlignment + $0.lineBreakMode = lineBreakMode } attributedString.addAttribute(.baselineOffset, value: baselineOffset, range: entireRange) attributedString.addAttribute( .paragraphStyle, value: paragraph, range: entireRange) @@ -207,6 +206,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt } else if viewModel.textPosition != .left { let paragraph = NSMutableParagraphStyle().with { $0.alignment = viewModel.textPosition.textAlignment + $0.lineBreakMode = lineBreakMode } attributedString.addAttribute( .paragraphStyle, value: paragraph, range: entireRange) }