// // LabelAttributeAction.swift // VDS // // Created by Matt Bruce on 8/3/22. // import Foundation import UIKit import Combine public protocol LabelAttributeActionable: LabelAttributeModel { var action: PassthroughSubject { get set } } public struct LabelAttributeActionModel: LabelAttributeActionable { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- public var location: Int public var length: Int public var action = PassthroughSubject() //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- public init(location: Int, length: Int) { self.location = location self.length = length } private enum CodingKeys: String, CodingKey { case location, length } public func setAttribute(on attributedString: NSMutableAttributedString) { attributedString.addAttribute(.underlineStyle, value: UnderlineStyle.single.value(), range: range) } }