vds_ios/VDS/Components/TitleLockup/TitleLockupSubTitleModel.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

60 lines
2.1 KiB
Swift

//
// TitleLockupSubTitleModel.swift
// VDS
//
// Created by Matt Bruce on 1/6/23.
//
import Foundation
import UIKit
extension TitleLockup {
/// Model that represents the options available for the sub title label.
public struct SubTitleModel {
/// Text that will be used for the subTitle label.
public var text: String
/// Standard style that will be used for the subTitle label.
public var otherStandardStyle: OtherStandardStyle
/// Text color used in the subtitle label.
public var textColor: TextColor
/// Array of LabelAttributeModel objects used in rendering the text in the subtitle label.
public var textAttributes: [any LabelAttributeModel]?
/// Number of lines used in the subtitle label.
public var numberOfLines: Int
/// LineBreakMode used in subtitle label.
public var lineBreakMode: NSLineBreakMode
public init(text: String,
otherStandardStyle: OtherStandardStyle = .bodyLarge,
textColor: TextColor = .primary,
textAttributes: [any LabelAttributeModel]? = nil,
numberOfLines: Int = 0,
lineBreakMode: NSLineBreakMode = .byWordWrapping) {
self.text = text
self.otherStandardStyle = otherStandardStyle
self.textColor = textColor
self.textAttributes = textAttributes
self.numberOfLines = numberOfLines
self.lineBreakMode = lineBreakMode
}
/// TextStyle used to render the text.
public var textStyle: TextStyle { otherStandardStyle.value.regular }
public static func == (lhs: TitleLockup.SubTitleModel, rhs: TitleLockup.SubTitleModel) -> Bool {
lhs.text == rhs.text
&& lhs.textColor == rhs.textColor
&& lhs.otherStandardStyle == rhs.otherStandardStyle
&& lhs.textAttributes == rhs.textAttributes
&& lhs.lineBreakMode == rhs.lineBreakMode
&& lhs.numberOfLines == rhs.numberOfLines
}
}
}