removed codable

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-01-25 11:50:11 -06:00
parent cb9ca6236b
commit 21ac83af4f
23 changed files with 30 additions and 106 deletions

View File

@ -17,7 +17,7 @@ public class Badge: View, Accessable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum FillColor: String, Codable, CaseIterable { public enum FillColor: String, CaseIterable {
case red, yellow, green, orange, blue, black, white case red, yellow, green, orange, blue, black, white
} }

View File

@ -11,7 +11,7 @@ import VDSColorTokens
import VDSFormControlsTokens import VDSFormControlsTokens
import Combine import Combine
public enum ButtonSize: String, CaseIterable, Codable { public enum ButtonSize: String, CaseIterable {
case large case large
case small case small
} }

View File

@ -17,7 +17,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum ButtonPosition: String, CaseIterable, Codable { public enum ButtonPosition: String, CaseIterable {
case left, center, right case left, center, right
} }

View File

@ -17,7 +17,7 @@ open class TextLinkCaret: ButtonBase {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum IconPosition: String, CaseIterable, Codable { public enum IconPosition: String, CaseIterable {
case left, right case left, right
} }

View File

@ -10,7 +10,7 @@ import VDSColorTokens
import UIKit import UIKit
extension Icon { extension Icon {
public enum Color: String, CaseIterable, Codable { public enum Color: String, CaseIterable {
case black case black
case white case white
case red case red

View File

@ -10,7 +10,7 @@ import UIKit
import VDSColorTokens import VDSColorTokens
extension Icon { extension Icon {
public struct Name: RawRepresentable, Codable { public struct Name: RawRepresentable {
public typealias RawValue = String public typealias RawValue = String
public var rawValue: String public var rawValue: String

View File

@ -8,7 +8,7 @@
import Foundation import Foundation
extension Icon { extension Icon {
public enum Size: String, CaseIterable, Codable { public enum Size: String, CaseIterable {
case xsmall case xsmall
case small case small
case medium case medium

View File

@ -64,7 +64,7 @@ extension UnderlineLabelAttribute {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum Style: String, Codable { public enum Style: String {
case none case none
case single case single
case thick case thick
@ -87,7 +87,7 @@ extension UnderlineLabelAttribute {
} }
} }
public enum Pattern: String, Codable { public enum Pattern: String {
case dot case dot
case dash case dash
case dashDot case dashDot

View File

@ -16,7 +16,7 @@ open class EntryField: Control, Accessable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum HelperTextPlacement: String, CaseIterable, Codable { public enum HelperTextPlacement: String, CaseIterable {
case bottom, right case bottom, right
} }

View File

@ -16,7 +16,7 @@ public class InputField: EntryField, UITextFieldDelegate {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum FieldType: String, CaseIterable, Codable { public enum FieldType: String, CaseIterable {
case text, number, calendar, inlineAction, password, creditCard, tel, date, securityCode case text, number, calendar, inlineAction, password, creditCard, tel, date, securityCode
} }

View File

@ -34,14 +34,14 @@ open class TileContainer: Control {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum BackgroundColor: String, CaseIterable, Codable { public enum BackgroundColor: String, CaseIterable {
case white case white
case black case black
case gray case gray
case transparent case transparent
} }
public enum Padding: String, CaseIterable, Codable { public enum Padding: String, CaseIterable {
case padding2X case padding2X
case padding4X case padding4X
case padding6X case padding6X
@ -64,7 +64,7 @@ open class TileContainer: Control {
} }
} }
public enum AspectRatio: String, CaseIterable, Codable { public enum AspectRatio: String, CaseIterable {
case ratio1x1 = "1:1" case ratio1x1 = "1:1"
case ratio3x4 = "3:4" case ratio3x4 = "3:4"
case ratio4x3 = "4:3" case ratio4x3 = "4:3"

View File

@ -15,7 +15,7 @@ open class Tilelet: TileContainer {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum TextPosition: String, CaseIterable, Codable { public enum TextPosition: String, CaseIterable {
case top case top
case bottom case bottom
} }

View File

@ -24,14 +24,3 @@ extension Tilelet {
} }
} }
} }
extension Tilelet.BadgeModel: Codable {
public init(from decoder: Decoder) throws {
let container: KeyedDecodingContainer<Tilelet.BadgeModel.CodingKeys> = try decoder.container(keyedBy: Tilelet.BadgeModel.CodingKeys.self)
self.text = try container.decode(String.self, forKey: Tilelet.BadgeModel.CodingKeys.text)
self.fillColor = try container.decodeIfPresent(Badge.FillColor.self, forKey: Tilelet.BadgeModel.CodingKeys.fillColor) ?? .red
self.surface = try container.decodeIfPresent(Surface.self, forKey: Tilelet.BadgeModel.CodingKeys.surface) ?? .light
self.numberOfLines = try container.decodeIfPresent(Int.self, forKey: Tilelet.BadgeModel.CodingKeys.numberOfLines) ?? 0
self.maxWidth = try container.decodeIfPresent(CGFloat.self, forKey: Tilelet.BadgeModel.CodingKeys.maxWidth)
}
}

View File

@ -32,28 +32,3 @@ extension Tilelet {
} }
} }
} }
extension Tilelet.DescriptiveIcon: Codable {
private enum CodingKeys: String, CodingKey {
case name, size, surface
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.name = try container.decodeIfPresent(Icon.Name.self, forKey: .name) ?? .multipleDocuments
self.size = try container.decodeIfPresent(Icon.Size.self, forKey: .size) ?? .medium
self.surface = try container.decodeIfPresent(Surface.self, forKey: .surface) ?? .dark
}
}
extension Tilelet.DirectionalIcon: Codable {
private enum CodingKeys: String, CodingKey {
case size, surface
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.size = try container.decodeIfPresent(Icon.Size.self, forKey: .size) ?? .medium
self.surface = try container.decodeIfPresent(Surface.self, forKey: .surface) ?? .dark
}
}

View File

@ -12,7 +12,7 @@ extension Tilelet {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum TextStyle: String, EnumSubset, Codable { public enum TextStyle: String, EnumSubset {
case bodyLarge case bodyLarge
case boldBodyLarge case boldBodyLarge
case bodyMedium case bodyMedium
@ -53,23 +53,3 @@ extension Tilelet {
} }
} }
} }
extension Tilelet.SubTitleModel: Codable {
private enum CodingKeys: String, CodingKey {
case text, textStyle, textColor
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.text = try container.decode(String.self, forKey: .text)
self.textStyle = try container.decodeIfPresent(TextStyle.self, forKey: .textStyle) ?? .bodySmall
self.textColor = try container.decodeIfPresent(Use.self, forKey: .textColor) ?? .primary
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(text, forKey: .text)
try container.encode(textStyle, forKey: .textStyle)
try container.encode(textColor, forKey: .textColor)
}
}

View File

@ -12,7 +12,7 @@ extension Tilelet {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum TextStyle: String, EnumSubset, Codable { public enum TextStyle: String, EnumSubset {
case titleXLarge case titleXLarge
case boldTitleXLarge case boldTitleXLarge
case titleLarge case titleLarge
@ -53,23 +53,3 @@ extension Tilelet {
} }
} }
} }
extension Tilelet.TitleModel: Codable {
private enum CodingKeys: String, CodingKey {
case text, textStyle
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.text = try container.decode(String.self, forKey: .text)
self.textStyle = try container.decodeIfPresent(TextStyle.self, forKey: .textStyle) ?? .boldTitleSmall
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(text, forKey: .text)
try container.encode(textStyle, forKey: .textStyle)
}
}

View File

@ -16,7 +16,7 @@ open class TitleLockup: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum TextPosition: String, Codable, EnumSubset { public enum TextPosition: String, EnumSubset {
case left, center case left, center
public var defaultValue: VDS.TextPosition { .left } public var defaultValue: VDS.TextPosition { .left }

View File

@ -11,7 +11,7 @@ extension TitleLockup {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum TitleTextStyle: String, Codable, EnumSubset { public enum TitleTextStyle: String, EnumSubset {
case featureMedium case featureMedium
case boldFeatureMedium case boldFeatureMedium
@ -34,7 +34,7 @@ extension TitleLockup {
public var defaultValue: TextStyle {.boldFeatureXSmall } public var defaultValue: TextStyle {.boldFeatureXSmall }
} }
public enum OtherTextStyle: String, Codable, EnumSubset { public enum OtherTextStyle: String, EnumSubset {
case bodyLarge case bodyLarge
case boldBodyLarge case boldBodyLarge
case bodyMedium case bodyMedium

View File

@ -33,15 +33,15 @@ open class ToggleBase: Control, Accessable, DataTrackable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum TextSize: String, Codable, CaseIterable { public enum TextSize: String, CaseIterable {
case small, large case small, large
} }
public enum TextWeight: String, Codable, CaseIterable { public enum TextWeight: String, CaseIterable {
case regular, bold case regular, bold
} }
public enum TextPosition: String, Codable, CaseIterable { public enum TextPosition: String, CaseIterable {
case left, right case left, right
} }

View File

@ -8,7 +8,7 @@
import Foundation import Foundation
public struct VDSLayout { public struct VDSLayout {
public enum Spacing: String, Codable, CaseIterable { public enum Spacing: String, CaseIterable {
case space1X case space1X
case space2X case space2X
case space3X case space3X

View File

@ -9,7 +9,7 @@ import Foundation
import UIKit import UIKit
import VDSColorTokens import VDSColorTokens
public enum Surface: String, Codable, Equatable { public enum Surface: String, Equatable {
case light, dark case light, dark
public var color: UIColor { public var color: UIColor {
return self == .dark ? VDSColor.backgroundPrimaryDark : VDSColor.backgroundSecondaryLight return self == .dark ? VDSColor.backgroundPrimaryDark : VDSColor.backgroundSecondaryLight

View File

@ -9,7 +9,7 @@ import Foundation
import UIKit import UIKit
import VDSColorTokens import VDSColorTokens
public enum Use: String, Codable, Equatable { public enum Use: String, Equatable {
case primary, secondary case primary, secondary
} }

View File

@ -8,7 +8,7 @@
import Foundation import Foundation
import VDSTypographyTokens import VDSTypographyTokens
public enum TextPosition: String, Codable, CaseIterable { public enum TextPosition: String, CaseIterable {
case left, right, center case left, right, center
var textAlignment: NSTextAlignment { var textAlignment: NSTextAlignment {
@ -23,7 +23,7 @@ public enum TextPosition: String, Codable, CaseIterable {
} }
} }
public enum TextStyle: String, Codable, CaseIterable { public enum TextStyle: String, CaseIterable {
case featureXLarge case featureXLarge
case boldFeatureXLarge case boldFeatureXLarge
@ -64,7 +64,7 @@ public enum TextStyle: String, Codable, CaseIterable {
//MARK: FontCategory //MARK: FontCategory
extension TextStyle { extension TextStyle {
public enum FontCategory: String, Codable, CaseIterable { public enum FontCategory: String, CaseIterable {
case feature = "Feature" case feature = "Feature"
case title = "Title" case title = "Title"
case body = "Body" case body = "Body"
@ -95,7 +95,7 @@ extension TextStyle {
//MARK: FontSize //MARK: FontSize
extension TextStyle { extension TextStyle {
public enum FontSize: String, Codable, CaseIterable { public enum FontSize: String, CaseIterable {
case xxlarge = "2XLarge" case xxlarge = "2XLarge"
case xlarge = "XLarge" case xlarge = "XLarge"
case large = "Large" case large = "Large"