vds_ios/VDS/Components/Tilelet/TiletEyebrowModel.swift
Matt Bruce aa013f62e3 added equatable to structs
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2024-08-26 09:03:17 -05:00

74 lines
3.0 KiB
Swift

//
// TiletEyebrowModel.swift
// VDS
//
// Created by Bandaru, Krishna Kishore on 13/03/24.
//
import Foundation
import UIKit
extension Tilelet {
/// Model that represents the options available for the eyebrow label.
public struct EyebrowModel: Equatable {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
/// Text that will be used for the eyebrow label.
public var text: String = ""
/// Text color that will be used for the eyebrow label
public var textColor: TitleLockup.TextColor
/// Used in combination with standardStyle to set the textStyle that will be used for the eyebrow label.
public var isBold: Bool = false
/// Text attributes that will be used for the eyebrow label.
public var textAttributes: [any LabelAttributeModel]?
/// Text style that will be used for the eyebrow label. If subtitle standard style
public var standardStyle: Tilelet.SubTitleModel.OtherStandardStyle = .titleSmall
/// LineBreakMode used in Badge label.
public var lineBreakMode: NSLineBreakMode
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public init(text: String,
textColor: TitleLockup.TextColor = .primary,
textAttributes: [any LabelAttributeModel]? = nil,
isBold: Bool = true,
standardStyle: Tilelet.SubTitleModel.OtherStandardStyle = .bodySmall,
lineBreakMode: NSLineBreakMode = .byTruncatingTail) {
self.text = text
self.textColor = textColor
self.textAttributes = textAttributes
self.standardStyle = standardStyle
self.isBold = isBold
self.lineBreakMode = lineBreakMode
}
//--------------------------------------------------
// MARK: - Public Methods
//--------------------------------------------------
/// Converts this type of model to a TitleLockup.TitleModel.
public func toTitleLockupEyebrowModel() -> TitleLockup.EyebrowModel {
TitleLockup.EyebrowModel(text: text,
textColor: textColor,
isBold: isBold,
standardStyle: standardStyle.value,
textAttributes: textAttributes)
}
public static func == (lhs: Tilelet.EyebrowModel, rhs: Tilelet.EyebrowModel) -> Bool {
lhs.text == rhs.text
&& lhs.textColor == rhs.textColor
&& lhs.isBold == rhs.isBold
&& lhs.textAttributes == rhs.textAttributes
&& lhs.standardStyle == rhs.standardStyle
&& lhs.lineBreakMode == rhs.lineBreakMode
}
}
}