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