vds_ios/VDS/Components/Tilelet/TileletTitleModel.swift
Matt Bruce c0236a433c documentation
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2023-08-30 10:08:28 -05:00

59 lines
2.2 KiB
Swift

//
// TiletTitleModel.swift
// VDS
//
// Created by Matt Bruce on 1/6/23.
//
import Foundation
extension Tilelet {
/// Model that represents the options available for the title label.
public struct TitleModel {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
/// Enum for the textStyle of the title label.
public enum StandardStyle: String, EnumSubset {
case titleXLarge
case titleLarge
case titleMedium
case titleSmall
public var defaultValue: TitleLockup.TitleStandardStyle { .titleSmall }
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
/// Text that will be used for the title label.
public var text: String = ""
/// Text attributes that will be used for the title label.
public var textAttributes: [any LabelAttributeModel]?
/// Text style that will be used for the title label.
public var standardStyle: StandardStyle = .titleSmall
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public init(text: String,
textAttributes: [any LabelAttributeModel]? = nil,
standardStyle: StandardStyle = .titleSmall) {
self.text = text
self.textAttributes = textAttributes
self.standardStyle = standardStyle
}
//--------------------------------------------------
// MARK: - Public Methods
//--------------------------------------------------
/// Converts this type of model to a TitleLockup.TitleModel.
public func toTitleLockupTitleModel() -> TitleLockup.TitleModel {
TitleLockup.TitleModel(text: text,
textAttributes: textAttributes,
standardStyle: standardStyle.value)
}
}
}