vds_ios/VDS/Components/Label/Attributes/ToolTipLabelAttribute.swift
Matt Bruce 02a3bd9e78 refactored names of XXXLabelAttribute
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2022-10-04 15:08:03 -05:00

40 lines
1.2 KiB
Swift

//
// ToolTipLabelAttribute.swift
// VDS
//
// Created by Matt Bruce on 10/4/22.
//
import Foundation
import UIKit
import Combine
public struct ToolTipLabelAttribute: ActionLabelAttributeModel {
public var id = UUID()
public var accessibleText: String? = "Tool Tip"
public var action = PassthroughSubject<Void, Never>()
public var location: Int
public var length: Int
public var tintColor: UIColor
public func setAttribute(on attributedString: NSMutableAttributedString) {
let image = SystemImageLabelAttribute(location: location,
length: length,
imageName: "info.circle",
frame: .init(x: 0, y: -2, width: 13.3, height: 13.3),
tintColor: tintColor)
image.setAttribute(on: attributedString)
}
public static func == (lhs: ToolTipLabelAttribute, rhs: ToolTipLabelAttribute) -> Bool {
lhs.isEqual(rhs)
}
public func isEqual(_ equatable: ToolTipLabelAttribute) -> Bool {
return id == equatable.id && range == equatable.range
}
}