Merge branch 'feature/tilet' into 'develop'

removed codable and updated model

See merge request BPHV_MIPS/vds_ios!35
This commit is contained in:
Bruce, Matt R 2023-01-25 19:05:43 +00:00
commit ef2bb6cfe6
29 changed files with 147 additions and 157 deletions

View File

@ -66,6 +66,7 @@
EA985C2D296F03FE00F2FF2E /* TileletIconModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA985C2C296F03FE00F2FF2E /* TileletIconModels.swift */; };
EA985C672970C21600F2FF2E /* VDSLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA985C662970C21600F2FF2E /* VDSLayout.swift */; };
EA985C692971B90B00F2FF2E /* IconSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA985C682971B90B00F2FF2E /* IconSize.swift */; };
EA985C7D297DAED300F2FF2E /* Primitive.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA985C7C297DAED300F2FF2E /* Primitive.swift */; };
EAA5EEB528ECBFB4003B3210 /* ImageLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEB428ECBFB4003B3210 /* ImageLabelAttribute.swift */; };
EAA5EEB728ECC03A003B3210 /* ToolTipLabelAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEB628ECC03A003B3210 /* ToolTipLabelAttribute.swift */; };
EAA5EEB928ECD24B003B3210 /* Icons.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EAA5EEB828ECD24B003B3210 /* Icons.xcassets */; };
@ -181,6 +182,7 @@
EA985C2C296F03FE00F2FF2E /* TileletIconModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TileletIconModels.swift; sourceTree = "<group>"; };
EA985C662970C21600F2FF2E /* VDSLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VDSLayout.swift; sourceTree = "<group>"; };
EA985C682971B90B00F2FF2E /* IconSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconSize.swift; sourceTree = "<group>"; };
EA985C7C297DAED300F2FF2E /* Primitive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Primitive.swift; sourceTree = "<group>"; };
EAA5EEB428ECBFB4003B3210 /* ImageLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageLabelAttribute.swift; sourceTree = "<group>"; };
EAA5EEB628ECC03A003B3210 /* ToolTipLabelAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolTipLabelAttribute.swift; sourceTree = "<group>"; };
EAA5EEB828ECD24B003B3210 /* Icons.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Icons.xcassets; sourceTree = "<group>"; };
@ -400,6 +402,7 @@
EA3361AE288B26310071C351 /* FormFieldable.swift */,
EA3361BE288B2EA60071C351 /* Handlerable.swift */,
EA33624628931B050071C351 /* Initable.swift */,
EA985C7C297DAED300F2FF2E /* Primitive.swift */,
EAF7F0A5289B0CE000B287F5 /* Resetable.swift */,
EA3361C8289054C50071C351 /* Surfaceable.swift */,
EA3361B7288B2AAA0071C351 /* ViewProtocol.swift */,
@ -799,6 +802,7 @@
EAB1D2CF28ABEF2B00DAE764 /* Typography.swift in Sources */,
EAF7F09A2899B17200B287F5 /* CATransaction.swift in Sources */,
EAF7F0A2289AFB3900B287F5 /* Errorable.swift in Sources */,
EA985C7D297DAED300F2FF2E /* Primitive.swift in Sources */,
EAB5FEF829393A7200998C17 /* ButtonGroupConstants.swift in Sources */,
EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */,
EA5E3058295105A40082B959 /* Tilelet.swift in Sources */,

View File

@ -10,7 +10,7 @@ import UIKit
import Combine
@objc(VDSControl)
open class Control: UIControl, Handlerable, ViewProtocol, Resettable {
open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
// MARK: - Combine Properties
@ -23,6 +23,8 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable {
//--------------------------------------------------
private var initialSetupPerformed = false
open var userInfo = [String: Primitive]()
open var surface: Surface = .light { didSet { didChange() } }
open var disabled: Bool = false { didSet { isEnabled = !disabled } }

View File

@ -11,7 +11,7 @@ import Combine
@objc(VDSView)
open class View: UIView, Handlerable, ViewProtocol, Resettable {
open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
// MARK: - Combine Properties
@ -24,6 +24,8 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable {
//--------------------------------------------------
private var initialSetupPerformed = false
open var userInfo = [String: Primitive]()
open var surface: Surface = .light { didSet { didChange() }}
open var disabled: Bool = false { didSet { isEnabled = !disabled } }

View File

@ -17,14 +17,14 @@ public class Badge: View, Accessable {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
public enum FillColor: String, Codable, CaseIterable {
public enum FillColor: String, CaseIterable {
case red, yellow, green, orange, blue, black, white
}
//--------------------------------------------------
// MARK: - Private Properties
// MARK: - Public Properties
//--------------------------------------------------
private var label = Label().with {
open var label = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.adjustsFontSizeToFitWidth = false
$0.lineBreakMode = .byTruncatingTail
@ -32,9 +32,6 @@ public class Badge: View, Accessable {
$0.textStyle = .boldBodySmall
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var fillColor: FillColor = .red { didSet { didChange() }}
open var text: String = "" { didSet { didChange() }}

View File

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

View File

@ -18,7 +18,7 @@ public protocol Buttonable: UIControl, Surfaceable, Disabling {
}
@objc(VDSButtonBase)
open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettable {
open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
// MARK: - Configuration Properties
//--------------------------------------------------
@ -48,6 +48,8 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
open var disabled: Bool = false { didSet { isEnabled = !disabled } }
open var userInfo = [String: Primitive]()
var isHighlightAnimating = false
open override var isHighlighted: Bool {
didSet {

View File

@ -73,28 +73,28 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
$0.axis = .vertical
}
private var label = Label().with {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var label = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .boldBodyLarge
}
private var childLabel = Label().with {
open var childLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodyLarge
}
private var errorLabel = Label().with {
open var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodyMedium
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var selectorView = UIView().with {
open var selectorView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}

View File

@ -19,15 +19,15 @@ public class Icon: View {
private var widthConstraint: NSLayoutConstraint?
private var heightConstraint: NSLayoutConstraint?
private var imageView = UIImageView().with {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var imageView = UIImageView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.contentMode = .scaleAspectFill
$0.clipsToBounds = true
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var color: Color = .black { didSet { didChange() }}
open var size: Size = .medium { didSet { didChange() }}
open var name: Name? { didSet { didChange() }}

View File

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

View File

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

View File

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

View File

@ -11,7 +11,7 @@ import VDSColorTokens
import Combine
@objc(VDSLabel)
public class Label: UILabel, Handlerable, ViewProtocol, Resettable {
public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
// MARK: - Combine Properties
@ -37,6 +37,8 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable {
open var textPosition: TextPosition = .left { didSet { didChange() }}
open var userInfo = [String: Primitive]()
open override var isEnabled: Bool {
get { !disabled }
set {

View File

@ -67,27 +67,27 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
$0.isHidden = false
}
private var textLabel = Label().with {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var textLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .boldBodyLarge
}
private var subTextLabel = Label().with {
open var subTextLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodyLarge
}
private var subTextRightLabel = Label().with {
open var subTextRightLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .right
$0.textStyle = .bodyLarge
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var selectorView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}

View File

@ -80,27 +80,27 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
$0.axis = .vertical
}
private var label = Label().with {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var label = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .boldBodyLarge
}
private var childLabel = Label().with {
open var childLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodyLarge
}
private var errorLabel = Label().with {
open var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodyMedium
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var selectorView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}

View File

@ -45,26 +45,7 @@ open class EntryField: Control, Accessable {
$0.distribution = .fill
}
}()
internal var titleLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.attributes = []
$0.textPosition = .left
$0.textStyle = .bodySmall
}
internal var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall
}
internal var helperLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall
}
internal var containerView: UIView = {
return UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
@ -85,13 +66,7 @@ open class EntryField: Control, Accessable {
$0.translatesAutoresizingMaskIntoConstraints = false
}
}()
internal var tooltipView: UIView?
internal var icon: Icon = Icon().with {
$0.size = .small
}
//--------------------------------------------------
// MARK: - Configuration Properties
//--------------------------------------------------
@ -123,6 +98,30 @@ open class EntryField: Control, Accessable {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var titleLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.attributes = []
$0.textPosition = .left
$0.textStyle = .bodySmall
}
open var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall
}
open var helperLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall
}
open var tooltipView: UIView?
open var icon: Icon = Icon().with {
$0.size = .small
}
open var labelText: String? { didSet { didChange() }}
open var helperText: String? { didSet { didChange() }}

View File

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

View File

@ -15,7 +15,7 @@ open class Tilelet: TileContainer {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
public enum TextPosition: String, Codable, CaseIterable {
public enum TextPosition: String, CaseIterable {
case top
case bottom
}
@ -50,8 +50,20 @@ open class Tilelet: TileContainer {
private var titleLockupContainerView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}
private var titleLockup = TitleLockup().with {
private var badgeContainerView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}
private let iconContainerView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.backgroundColor = .clear
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var titleLockup = TitleLockup().with {
let configs = [
TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall],
neighboring: [
@ -113,28 +125,16 @@ open class Tilelet: TileContainer {
$0.bottomTextStyleSpacingConfig = TextStyle.SpacingConfig(configs: configs)
}
private var badgeContainerView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}
private var badge = Badge().with {
open var badge = Badge().with {
$0.fillColor = .red
}
private let iconContainerView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.backgroundColor = .clear
}
open var descriptiveIcon = Icon()
private var descriptiveIcon = Icon()
private var directionalIcon = Icon().with {
open var directionalIcon = Icon().with {
$0.name = .rightArrow
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
//style
private var _textWidth: CGFloat?
open var textWidth: CGFloat? {
get { _textWidth }

View File

@ -8,10 +8,10 @@
import Foundation
extension Tilelet {
public struct BadgeModel: Codable {
public struct BadgeModel {
public var text: String = ""
public var fillColor: Badge.FillColor = .red
public var surface: Surface = .light
public var fillColor: Badge.FillColor
public var surface: Surface
public var numberOfLines: Int
public var maxWidth: CGFloat?
@ -22,14 +22,5 @@ extension Tilelet {
self.numberOfLines = numberOfLines
self.maxWidth = maxWidth
}
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

@ -10,38 +10,25 @@ import UIKit
extension Tilelet {
public struct DescriptiveIcon: Codable {
public var name: Icon.Name = .multipleDocuments
public var size: Icon.Size = .medium
public var surface: Surface = .dark
public struct DescriptiveIcon {
public var name: Icon.Name
public var size: Icon.Size
public var surface: Surface
public init(name: Icon.Name = .multipleDocuments, size: Icon.Size, surface: Surface) {
public init(name: Icon.Name = .multipleDocuments, size: Icon.Size = .medium, surface: Surface = .dark) {
self.name = name
self.size = size
self.surface = surface
}
public init(from decoder: Decoder) throws {
let container: KeyedDecodingContainer<Tilelet.DescriptiveIcon.CodingKeys> = try decoder.container(keyedBy: Tilelet.DescriptiveIcon.CodingKeys.self)
self.name = try container.decodeIfPresent(Icon.Name.self, forKey: Tilelet.DescriptiveIcon.CodingKeys.name) ?? .multipleDocuments
self.size = try container.decodeIfPresent(Icon.Size.self, forKey: Tilelet.DescriptiveIcon.CodingKeys.size) ?? .medium
self.surface = try container.decodeIfPresent(Surface.self, forKey: Tilelet.DescriptiveIcon.CodingKeys.surface) ?? .dark
}
}
public struct DirectionalIcon: Codable {
public var size: Icon.Size = .medium
public var surface: Surface = .dark
public struct DirectionalIcon {
public var size: Icon.Size
public var surface: Surface
public init(size: Icon.Size, surface: Surface) {
public init(size: Icon.Size = .medium, surface: Surface = .dark) {
self.size = size
self.surface = surface
}
public init(from decoder: Decoder) throws {
let container: KeyedDecodingContainer<Tilelet.DirectionalIcon.CodingKeys> = try decoder.container(keyedBy: Tilelet.DirectionalIcon.CodingKeys.self)
self.size = try container.decodeIfPresent(Icon.Size.self, forKey: Tilelet.DirectionalIcon.CodingKeys.size) ?? .medium
self.surface = try container.decodeIfPresent(Surface.self, forKey: Tilelet.DirectionalIcon.CodingKeys.surface) ?? .dark
}
}
}

View File

@ -8,11 +8,11 @@
import Foundation
extension Tilelet {
public struct SubTitleModel: Codable {
public struct SubTitleModel {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
public enum TextStyle: String, Codable, EnumSubset {
public enum TextStyle: String, EnumSubset {
case bodyLarge
case boldBodyLarge
case bodyMedium
@ -22,12 +22,12 @@ extension Tilelet {
public var defaultValue: TitleLockup.OtherTextStyle { .bodySmall }
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var text: String = ""
public var textStyle: TextStyle = .bodySmall
public var textAttributes: [any LabelAttributeModel]?
public var textColor: Use = .primary
//--------------------------------------------------
@ -38,6 +38,7 @@ extension Tilelet {
textAttributes: [any LabelAttributeModel]? = nil,
textStyle: TextStyle = .bodySmall) {
self.text = text
self.textAttributes = textAttributes
self.textColor = textColor
self.textStyle = textStyle
}
@ -50,12 +51,5 @@ extension Tilelet {
textColor: textColor,
textAttributes: nil)
}
public init(from decoder: Decoder) throws {
let container: KeyedDecodingContainer<Tilelet.SubTitleModel.CodingKeys> = try decoder.container(keyedBy: Tilelet.SubTitleModel.CodingKeys.self)
self.text = try container.decode(String.self, forKey: Tilelet.SubTitleModel.CodingKeys.text)
self.textStyle = try container.decodeIfPresent(Tilelet.SubTitleModel.TextStyle.self, forKey: Tilelet.SubTitleModel.CodingKeys.textStyle) ?? .bodySmall
self.textColor = try container.decodeIfPresent(Use.self, forKey: Tilelet.SubTitleModel.CodingKeys.textColor) ?? .primary
}
}
}

View File

@ -8,11 +8,11 @@
import Foundation
extension Tilelet {
public struct TitleModel: Codable {
public struct TitleModel {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
public enum TextStyle: String, EnumSubset, Codable {
public enum TextStyle: String, EnumSubset {
case titleXLarge
case boldTitleXLarge
case titleLarge
@ -24,21 +24,24 @@ extension Tilelet {
public var defaultValue: TitleLockup.TitleTextStyle { .boldTitleSmall }
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var text: String = ""
public var textAttributes: [any LabelAttributeModel]?
public var textStyle: TextStyle = .boldTitleSmall
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public init(text: String,
textAttributes: [any LabelAttributeModel]? = nil,
textStyle: TextStyle = .boldTitleSmall) {
self.text = text
self.textAttributes = textAttributes
self.textStyle = textStyle
}
//--------------------------------------------------
// MARK: - Public Functions
@ -48,11 +51,5 @@ extension Tilelet {
textAttributes: nil,
textStyle: textStyle.value)
}
public init(from decoder: Decoder) throws {
let container: KeyedDecodingContainer<Tilelet.TitleModel.CodingKeys> = try decoder.container(keyedBy: Tilelet.TitleModel.CodingKeys.self)
self.text = try container.decode(String.self, forKey: Tilelet.TitleModel.CodingKeys.text)
self.textStyle = try container.decodeIfPresent(Tilelet.TitleModel.TextStyle.self, forKey: Tilelet.TitleModel.CodingKeys.textStyle) ?? .boldTitleSmall
}
}
}

View File

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

View File

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

View File

@ -33,15 +33,15 @@ open class ToggleBase: Control, Accessable, DataTrackable {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
public enum TextSize: String, Codable, CaseIterable {
public enum TextSize: String, CaseIterable {
case small, large
}
public enum TextWeight: String, Codable, CaseIterable {
public enum TextWeight: String, CaseIterable {
case regular, bold
}
public enum TextPosition: String, Codable, CaseIterable {
public enum TextPosition: String, CaseIterable {
case left, right
}
@ -68,11 +68,7 @@ open class ToggleBase: Control, Accessable, DataTrackable {
$0.axis = .horizontal
$0.distribution = .fill
}
private var label = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
}
private var toggleView = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}
@ -121,6 +117,10 @@ open class ToggleBase: Control, Accessable, DataTrackable {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
open var label = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
}
open var isOn: Bool {
get { isSelected }
set {

View File

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

View File

@ -0,0 +1,13 @@
public protocol Primitive {}
extension String: Primitive {}
extension Int: Primitive {}
extension Double: Primitive {}
extension Float: Primitive {}
extension Bool: Primitive {}
extension Array: Primitive where Element: Primitive {}
extension Dictionary: Primitive where Key == String, Value: Primitive {}
public protocol UserInfoable {
var userInfo: [String: Primitive] { get set }
}

View File

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

View File

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

View File

@ -8,7 +8,7 @@
import Foundation
import VDSTypographyTokens
public enum TextPosition: String, Codable, CaseIterable {
public enum TextPosition: String, CaseIterable {
case left, right, center
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 boldFeatureXLarge
@ -64,7 +64,7 @@ public enum TextStyle: String, Codable, CaseIterable {
//MARK: FontCategory
extension TextStyle {
public enum FontCategory: String, Codable, CaseIterable {
public enum FontCategory: String, CaseIterable {
case feature = "Feature"
case title = "Title"
case body = "Body"
@ -95,7 +95,7 @@ extension TextStyle {
//MARK: FontSize
extension TextStyle {
public enum FontSize: String, Codable, CaseIterable {
public enum FontSize: String, CaseIterable {
case xxlarge = "2XLarge"
case xlarge = "XLarge"
case large = "Large"