// // LabelSystemImageLabelAttribute.swift // VDS // // Created by Matt Bruce on 10/4/22. // import Foundation import UIKit public struct SystemImageLabelAttribute: AttachmentLabelAttributeModel { public var id = UUID() public var location: Int public var length: Int public var imageName: String public var frame: CGRect public var tintColor: UIColor public static func == (lhs: SystemImageLabelAttribute, rhs: SystemImageLabelAttribute) -> Bool { lhs.isEqual(rhs) } public func isEqual(_ equatable: SystemImageLabelAttribute) -> Bool { return id == equatable.id && range == equatable.range && imageName == equatable.imageName } public func getAttachment() throws -> NSTextAttachment { let attachment = NSTextAttachment() attachment.image = UIImage(systemName: imageName)?.withTintColor(tintColor) attachment.bounds = frame return attachment } }