vds_ios/VDS/Components/TitleLockup/TitleLockupTitleModel.swift
Matt Bruce ba8e557cd0 updated didset
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2023-08-30 18:04:46 -05:00

52 lines
1.7 KiB
Swift

//
// TitleLockupTitleModel.swift
// VDS
//
// Created by Matt Bruce on 1/6/23.
//
import Foundation
extension TitleLockup {
/// Model that represents the options available for the sub title label.
public struct TitleModel: Equatable, Identifiable {
public static func == (lhs: TitleModel, rhs: TitleModel) -> Bool {
lhs.id == rhs.id
}
public var id: String = UUID().uuidString
/// Text that will be used for the title label.
public var text: String
/// Array of LabelAttributeModel objects used in rendering the text.
public var textAttributes: [any LabelAttributeModel]?
/// Used in combination with standardStyle to set the textStyle that will be used for the title label.
public var isBold: Bool
/// Text style that will be used for the title label.
public var standardStyle: TitleStandardStyle
/// Number of lines that will be used for the title label.
public var numberOfLines: Int
public init(text: String,
textAttributes: [any LabelAttributeModel]? = nil,
isBold: Bool = true,
standardStyle: TitleStandardStyle = .featureXSmall,
numberOfLines: Int = 0) {
self.text = text
self.isBold = isBold
self.textAttributes = textAttributes
self.standardStyle = standardStyle
self.numberOfLines = numberOfLines
}
/// TextStyle used to render the text.
public var textStyle: TextStyle { isBold ? standardStyle.value.bold : standardStyle.value.regular }
}
}