// // LabelAttributeFont.swift // VDS // // Created by Matt Bruce on 8/3/22. // import Foundation import UIKit public struct LabelAttributeFont: LabelAttributeModel { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- public var location: Int public var length: Int public var style: TypographicalStyle @CodableColor public var color: UIColor //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- public init(location: Int, length: Int, style: TypographicalStyle, color: UIColor = .black) { self.location = location self.length = length self.style = style self.color = color } public func setAttribute(on attributedString: NSMutableAttributedString) { attributedString.removeAttribute(.font, range: range) attributedString.removeAttribute(.foregroundColor, range: range) attributedString.addAttribute(.font, value: style.font, range: range) attributedString.addAttribute(.foregroundColor, value: color, range: range) } }