64 lines
2.4 KiB
Swift
64 lines
2.4 KiB
Swift
//
|
|
// TiletSubTitleModel.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 1/6/23.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension Tilelet {
|
|
/// Model that represents the options available for the sub title label.
|
|
public struct SubTitleModel {
|
|
//--------------------------------------------------
|
|
// MARK: - Enums
|
|
//--------------------------------------------------
|
|
/// Enum used to describe the textStyle of the subTitle label.
|
|
public enum StandardStyle: String, EnumSubset {
|
|
case bodyLarge
|
|
case bodyMedium
|
|
case bodySmall
|
|
|
|
public var defaultValue: TitleLockup.OtherStandardStyle { .bodySmall }
|
|
}
|
|
//--------------------------------------------------
|
|
// MARK: - Public Properties
|
|
//--------------------------------------------------
|
|
/// Text that will be used for the subTitle label.
|
|
public var text: String = ""
|
|
|
|
/// Text style that will be used for the subTitle label.
|
|
public var standardStyle: StandardStyle = .bodySmall
|
|
|
|
/// Text attributes that will be used for the subTitle label.
|
|
public var textAttributes: [any LabelAttributeModel]?
|
|
|
|
/// Text color that will be used for the subTitle label.
|
|
public var textColor: Use = .primary
|
|
|
|
//--------------------------------------------------
|
|
// MARK: - Initializers
|
|
//--------------------------------------------------
|
|
public init(text: String,
|
|
textColor: Use = .primary,
|
|
textAttributes: [any LabelAttributeModel]? = nil,
|
|
standardStyle: StandardStyle = .bodySmall) {
|
|
self.text = text
|
|
self.textAttributes = textAttributes
|
|
self.textColor = textColor
|
|
self.standardStyle = standardStyle
|
|
}
|
|
|
|
//--------------------------------------------------
|
|
// MARK: - Public Methods
|
|
//--------------------------------------------------
|
|
/// Converts this type of model to a TitleLockup.SubTitleModel.
|
|
public func toTitleLockupSubTitleModel() -> TitleLockup.SubTitleModel {
|
|
TitleLockup.SubTitleModel(text: text,
|
|
standardStyle: standardStyle.value,
|
|
textColor: textColor,
|
|
textAttributes: textAttributes)
|
|
}
|
|
}
|
|
}
|