50 lines
1.4 KiB
Swift
50 lines
1.4 KiB
Swift
//
|
|
// TiletSubTitleModel.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 1/6/23.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct TiletSubTitleModel {
|
|
public enum SubTitleTypographicalStyle: String, Codable, EnumSubset {
|
|
case BodyLarge
|
|
case BoldBodyLarge
|
|
case BodyMedium
|
|
case BoldBodyMedium
|
|
case BodySmall
|
|
case BoldBodySmall
|
|
|
|
public var defaultValue: TitleLockupOtherTypographicalStyle { .BodySmall }
|
|
}
|
|
|
|
public var text: String = ""
|
|
public var textAttributes: [any LabelAttributeModel]?
|
|
public var typographicalStyle: SubTitleTypographicalStyle
|
|
public var textColor: Use
|
|
|
|
public init(text: String,
|
|
textColor: Use = .primary,
|
|
textAttributes: [any LabelAttributeModel]? = nil,
|
|
typographicalStyle: SubTitleTypographicalStyle = .BodySmall) {
|
|
self.text = text
|
|
self.textColor = textColor
|
|
self.textAttributes = textAttributes
|
|
self.typographicalStyle = typographicalStyle
|
|
}
|
|
}
|
|
|
|
extension TitleLockup {
|
|
public func set(with model: TiletSubTitleModel?) {
|
|
if let model, !model.text.isEmpty {
|
|
subTitleText = model.text
|
|
subTitleTextAttributes = model.textAttributes
|
|
otherTypograpicalStyle = model.typographicalStyle.value
|
|
subTitleColor = model.textColor
|
|
} else {
|
|
reset()
|
|
}
|
|
}
|
|
}
|