From ec9f853b3d685b405b91d1fb9d8ce6d75d376860 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 12 Jan 2023 13:38:36 -0600 Subject: [PATCH 1/3] made structs codable and remove textAttributes (for now on Tilet) Signed-off-by: Matt Bruce --- VDS/Components/Icon/Icon.swift | 2 +- VDS/Components/Icon/IconName.swift | 2 +- VDS/Components/Tilet/TiletBadgeModel.swift | 2 +- VDS/Components/Tilet/TiletIconModels.swift | 14 +++++++------- VDS/Components/Tilet/TiletSubTitleModel.swift | 6 ++---- VDS/Components/Tilet/TiletTitleModel.swift | 11 +++++------ 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/VDS/Components/Icon/Icon.swift b/VDS/Components/Icon/Icon.swift index eb0f28bd..754d78de 100644 --- a/VDS/Components/Icon/Icon.swift +++ b/VDS/Components/Icon/Icon.swift @@ -10,7 +10,7 @@ import UIKit import VDSColorTokens import Combine -public enum IconSize: String, CaseIterable { +public enum IconSize: String, CaseIterable, Codable { case xsmall case small case medium diff --git a/VDS/Components/Icon/IconName.swift b/VDS/Components/Icon/IconName.swift index fe58a1b0..84fd2579 100644 --- a/VDS/Components/Icon/IconName.swift +++ b/VDS/Components/Icon/IconName.swift @@ -9,7 +9,7 @@ import Foundation import UIKit import VDSColorTokens -public struct IconName: RawRepresentable { +public struct IconName: RawRepresentable, Codable { public typealias RawValue = String public var rawValue: String diff --git a/VDS/Components/Tilet/TiletBadgeModel.swift b/VDS/Components/Tilet/TiletBadgeModel.swift index fbad4d5f..88ffc82b 100644 --- a/VDS/Components/Tilet/TiletBadgeModel.swift +++ b/VDS/Components/Tilet/TiletBadgeModel.swift @@ -7,7 +7,7 @@ import Foundation -public struct TiletBadgeModel { +public struct TiletBadgeModel: Codable { public var text: String = "" public var fillColor: BadgeFillColor public var surface: Surface diff --git a/VDS/Components/Tilet/TiletIconModels.swift b/VDS/Components/Tilet/TiletIconModels.swift index 744631e1..bceefd82 100644 --- a/VDS/Components/Tilet/TiletIconModels.swift +++ b/VDS/Components/Tilet/TiletIconModels.swift @@ -8,10 +8,10 @@ import Foundation import UIKit -public struct TiletDescriptiveIcon { - public var name: IconName - public var size: IconSize - public var surface: Surface +public struct TiletDescriptiveIcon: Codable { + public var name: IconName = .multipleDocuments + public var size: IconSize = .medium + public var surface: Surface = .light public init(name: IconName = .multipleDocuments, size: IconSize, surface: Surface) { self.name = name @@ -20,9 +20,9 @@ public struct TiletDescriptiveIcon { } } -public struct TiletDirectionalIcon { - public var size: IconSize - public var surface: Surface +public struct TiletDirectionalIcon: Codable { + public var size: IconSize = .medium + public var surface: Surface = .light public init(size: IconSize, surface: Surface) { self.size = size diff --git a/VDS/Components/Tilet/TiletSubTitleModel.swift b/VDS/Components/Tilet/TiletSubTitleModel.swift index 10161008..a2472d8b 100644 --- a/VDS/Components/Tilet/TiletSubTitleModel.swift +++ b/VDS/Components/Tilet/TiletSubTitleModel.swift @@ -7,7 +7,7 @@ import Foundation -public struct TiletSubTitleModel { +public struct TiletSubTitleModel: Codable { public enum SubTitleTypographicalStyle: String, Codable, EnumSubset { case BodyLarge case BoldBodyLarge @@ -20,7 +20,6 @@ public struct TiletSubTitleModel { } public var text: String = "" - public var textAttributes: [any LabelAttributeModel]? public var typographicalStyle: SubTitleTypographicalStyle public var textColor: Use @@ -30,13 +29,12 @@ public struct TiletSubTitleModel { typographicalStyle: SubTitleTypographicalStyle = .BodySmall) { self.text = text self.textColor = textColor - self.textAttributes = textAttributes self.typographicalStyle = typographicalStyle } public func toTitleLockupSubTitleModel() -> TitleLockupSubTitleModel { TitleLockupSubTitleModel(text: text, textColor: textColor, - textAttributes: textAttributes) + textAttributes: nil) } } diff --git a/VDS/Components/Tilet/TiletTitleModel.swift b/VDS/Components/Tilet/TiletTitleModel.swift index 179c543a..349bc788 100644 --- a/VDS/Components/Tilet/TiletTitleModel.swift +++ b/VDS/Components/Tilet/TiletTitleModel.swift @@ -7,8 +7,8 @@ import Foundation -public struct TiletTitleModel { - public enum TitleTypographicalStyle: String, EnumSubset { +public struct TiletTitleModel: Codable { + public enum TitleTypographicalStyle: String, EnumSubset, Codable { case TitleXLarge case BoldTitleXLarge case TitleLarge @@ -22,18 +22,17 @@ public struct TiletTitleModel { } public var text: String = "" - public var textAttributes: [any LabelAttributeModel]? public var typographicalStyle: TitleTypographicalStyle public init(text: String, - textAttributes: [any LabelAttributeModel]? = nil, typographicalStyle: TitleTypographicalStyle = .BoldTitleSmall) { self.text = text - self.textAttributes = textAttributes self.typographicalStyle = typographicalStyle } public func toTitleLockupTitleModel() -> TitleLockupTitleModel { - TitleLockupTitleModel(text: text, textAttributes: textAttributes, typographicalStyle: typographicalStyle.value) + TitleLockupTitleModel(text: text, + textAttributes: nil, + typographicalStyle: typographicalStyle.value) } } From 0f8a564bc54aced39bc170b7323d59a71c3406c4 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 12 Jan 2023 15:58:27 -0600 Subject: [PATCH 2/3] added defaults Signed-off-by: Matt Bruce --- VDS/Components/Tilet/TiletSubTitleModel.swift | 4 ++-- VDS/Components/Tilet/TiletTitleModel.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Tilet/TiletSubTitleModel.swift b/VDS/Components/Tilet/TiletSubTitleModel.swift index a2472d8b..c2a2ca93 100644 --- a/VDS/Components/Tilet/TiletSubTitleModel.swift +++ b/VDS/Components/Tilet/TiletSubTitleModel.swift @@ -20,8 +20,8 @@ public struct TiletSubTitleModel: Codable { } public var text: String = "" - public var typographicalStyle: SubTitleTypographicalStyle - public var textColor: Use + public var typographicalStyle: SubTitleTypographicalStyle = .BodySmall + public var textColor: Use = .primary public init(text: String, textColor: Use = .primary, diff --git a/VDS/Components/Tilet/TiletTitleModel.swift b/VDS/Components/Tilet/TiletTitleModel.swift index 349bc788..fdf52187 100644 --- a/VDS/Components/Tilet/TiletTitleModel.swift +++ b/VDS/Components/Tilet/TiletTitleModel.swift @@ -22,7 +22,7 @@ public struct TiletTitleModel: Codable { } public var text: String = "" - public var typographicalStyle: TitleTypographicalStyle + public var typographicalStyle: TitleTypographicalStyle = .BoldTitleSmall public init(text: String, typographicalStyle: TitleTypographicalStyle = .BoldTitleSmall) { From 5b19ade48343f1e16c64deff39deeaf478f55322 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 12 Jan 2023 16:11:18 -0600 Subject: [PATCH 3/3] updated defaults Signed-off-by: Matt Bruce --- VDS/Components/Tilet/TiletIconModels.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Tilet/TiletIconModels.swift b/VDS/Components/Tilet/TiletIconModels.swift index bceefd82..79be1d07 100644 --- a/VDS/Components/Tilet/TiletIconModels.swift +++ b/VDS/Components/Tilet/TiletIconModels.swift @@ -11,7 +11,7 @@ import UIKit public struct TiletDescriptiveIcon: Codable { public var name: IconName = .multipleDocuments public var size: IconSize = .medium - public var surface: Surface = .light + public var surface: Surface = .dark public init(name: IconName = .multipleDocuments, size: IconSize, surface: Surface) { self.name = name @@ -22,7 +22,7 @@ public struct TiletDescriptiveIcon: Codable { public struct TiletDirectionalIcon: Codable { public var size: IconSize = .medium - public var surface: Surface = .light + public var surface: Surface = .dark public init(size: IconSize, surface: Surface) { self.size = size