diff --git a/VDS/Components/Label/Attributes/LabelAttributeAction.swift b/VDS/Components/Label/Attributes/LabelAttributeAction.swift index f2a5fe49..7e280a42 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeAction.swift +++ b/VDS/Components/Label/Attributes/LabelAttributeAction.swift @@ -10,6 +10,7 @@ import UIKit import Combine public protocol LabelAttributeActionable: LabelAttributeModel { + var accessibleText: String? { get set } var action: PassthroughSubject { get set } } @@ -29,15 +30,19 @@ public struct LabelAttributeActionModel: LabelAttributeActionable { public var id = UUID() public var location: Int public var length: Int + public var shouldUnderline: Bool + public var accessibleText: String? public var action = PassthroughSubject() //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- - public init(location: Int, length: Int) { + public init(location: Int, length: Int, shouldUnderline: Bool = true, accessibleText: String? = nil) { self.location = location self.length = length + self.shouldUnderline = shouldUnderline + self.accessibleText = accessibleText } private enum CodingKeys: String, CodingKey { @@ -45,6 +50,8 @@ public struct LabelAttributeActionModel: LabelAttributeActionable { } public func setAttribute(on attributedString: NSMutableAttributedString) { - attributedString.addAttribute(.underlineStyle, value: UnderlineStyle.single.value(), range: range) + if(shouldUnderline){ + attributedString.addAttribute(.underlineStyle, value: UnderlineStyle.single.value(), range: range) + } } }