Merge branch 'feature/tilet' into 'develop'

refactored structs into parent

See merge request BPHV_MIPS/vds_ios!31
This commit is contained in:
Bruce, Matt R 2023-01-13 20:35:31 +00:00
commit fdc1af7d3a
5 changed files with 124 additions and 115 deletions

View File

@ -171,13 +171,13 @@ open class Tilet: TileContainer {
open var textPostion: TextPosition = .top { didSet { didChange() }} open var textPostion: TextPosition = .top { didSet { didChange() }}
//models //models
public var badgeModel: TiletBadgeModel? { didSet { didChange() }} public var badgeModel: BadgeModel? { didSet { didChange() }}
public var titleModel: TiletTitleModel? { didSet { didChange() }} public var titleModel: TitleModel? { didSet { didChange() }}
public var subTitleModel: TiletSubTitleModel? { didSet { didChange() }} public var subTitleModel: SubTitleModel? { didSet { didChange() }}
//only 1 Icon can be active //only 1 Icon can be active
private var _descriptiveIconModel: TiletDescriptiveIcon? private var _descriptiveIconModel: DescriptiveIcon?
public var descriptiveIconModel: TiletDescriptiveIcon? { public var descriptiveIconModel: DescriptiveIcon? {
get { _descriptiveIconModel } get { _descriptiveIconModel }
set { set {
_descriptiveIconModel = newValue; _descriptiveIconModel = newValue;
@ -186,8 +186,8 @@ open class Tilet: TileContainer {
} }
} }
private var _directionalIconModel: TiletDirectionalIcon? private var _directionalIconModel: DirectionalIcon?
public var directionalIconModel: TiletDirectionalIcon? { public var directionalIconModel: DirectionalIcon? {
get { _directionalIconModel } get { _directionalIconModel }
set { set {
_directionalIconModel = newValue; _directionalIconModel = newValue;

View File

@ -7,17 +7,19 @@
import Foundation import Foundation
public struct TiletBadgeModel: Codable { extension Tilet {
public var text: String = "" public struct BadgeModel: Codable {
public var fillColor:Badge.FillColor public var text: String = ""
public var surface: Surface public var fillColor:Badge.FillColor
public var numberOfLines: Int public var surface: Surface
public var maxWidth: CGFloat? public var numberOfLines: Int
public init(text: String, fillColor: Badge.FillColor = .red, surface: Surface = .light, numberOfLines: Int = 0, maxWidth: CGFloat? = nil) { public var maxWidth: CGFloat?
self.text = text public init(text: String, fillColor: Badge.FillColor = .red, surface: Surface = .light, numberOfLines: Int = 0, maxWidth: CGFloat? = nil) {
self.fillColor = fillColor self.text = text
self.surface = surface self.fillColor = fillColor
self.numberOfLines = numberOfLines self.surface = surface
self.maxWidth = maxWidth self.numberOfLines = numberOfLines
self.maxWidth = maxWidth
}
} }
} }

View File

@ -8,24 +8,27 @@
import Foundation import Foundation
import UIKit import UIKit
public struct TiletDescriptiveIcon: Codable { extension Tilet {
public var name: Icon.Name = .multipleDocuments
public var size: Icon.Size = .medium
public var surface: Surface = .dark
public init(name: Icon.Name = .multipleDocuments, size: Icon.Size, surface: Surface) { public struct DescriptiveIcon: Codable {
self.name = name public var name: Icon.Name = .multipleDocuments
self.size = size public var size: Icon.Size = .medium
self.surface = surface public var surface: Surface = .dark
}
} public init(name: Icon.Name = .multipleDocuments, size: Icon.Size, surface: Surface) {
self.name = name
public struct TiletDirectionalIcon: Codable { self.size = size
public var size: Icon.Size = .medium self.surface = surface
public var surface: Surface = .dark }
}
public init(size: Icon.Size, surface: Surface) {
self.size = size public struct DirectionalIcon: Codable {
self.surface = surface public var size: Icon.Size = .medium
public var surface: Surface = .dark
public init(size: Icon.Size, surface: Surface) {
self.size = size
self.surface = surface
}
} }
} }

View File

@ -7,46 +7,48 @@
import Foundation import Foundation
public struct TiletSubTitleModel: Codable { extension Tilet {
//-------------------------------------------------- public struct SubTitleModel: Codable {
// MARK: - Enums //--------------------------------------------------
//-------------------------------------------------- // MARK: - Enums
public enum TextStyle: String, Codable, EnumSubset { //--------------------------------------------------
case BodyLarge public enum TextStyle: String, Codable, EnumSubset {
case BoldBodyLarge case BodyLarge
case BodyMedium case BoldBodyLarge
case BoldBodyMedium case BodyMedium
case BodySmall case BoldBodyMedium
case BoldBodySmall case BodySmall
case BoldBodySmall
public var defaultValue: TitleLockup.OtherTextStyle { .BodySmall } public var defaultValue: TitleLockup.OtherTextStyle { .BodySmall }
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var text: String = "" public var text: String = ""
public var textStyle: TextStyle = .BodySmall public var textStyle: TextStyle = .BodySmall
public var textColor: Use = .primary public var textColor: Use = .primary
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
//-------------------------------------------------- //--------------------------------------------------
public init(text: String, public init(text: String,
textColor: Use = .primary, textColor: Use = .primary,
textAttributes: [any LabelAttributeModel]? = nil, textAttributes: [any LabelAttributeModel]? = nil,
textStyle: TextStyle = .BodySmall) { textStyle: TextStyle = .BodySmall) {
self.text = text self.text = text
self.textColor = textColor self.textColor = textColor
self.textStyle = textStyle self.textStyle = textStyle
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Functions // MARK: - Public Functions
//-------------------------------------------------- //--------------------------------------------------
public func toTitleLockupSubTitleModel() -> TitleLockup.SubTitleModel { public func toTitleLockupSubTitleModel() -> TitleLockup.SubTitleModel {
TitleLockup.SubTitleModel(text: text, TitleLockup.SubTitleModel(text: text,
textColor: textColor, textColor: textColor,
textAttributes: nil) textAttributes: nil)
}
} }
} }

View File

@ -7,44 +7,46 @@
import Foundation import Foundation
public struct TiletTitleModel: Codable { extension Tilet {
//-------------------------------------------------- public struct TitleModel: Codable {
// MARK: - Enums //--------------------------------------------------
//-------------------------------------------------- // MARK: - Enums
public enum TextStyle: String, EnumSubset, Codable { //--------------------------------------------------
case TitleXLarge public enum TextStyle: String, EnumSubset, Codable {
case BoldTitleXLarge case TitleXLarge
case TitleLarge case BoldTitleXLarge
case BoldTitleLarge case TitleLarge
case TitleMedium case BoldTitleLarge
case BoldTitleMedium case TitleMedium
case TitleSmall case BoldTitleMedium
case BoldTitleSmall case TitleSmall
case BoldTitleSmall
public var defaultValue: TitleLockup.TitleTextStyle { .BoldTitleSmall } public var defaultValue: TitleLockup.TitleTextStyle { .BoldTitleSmall }
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var text: String = "" public var text: String = ""
public var textStyle: TextStyle = .BoldTitleSmall public var textStyle: TextStyle = .BoldTitleSmall
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
//-------------------------------------------------- //--------------------------------------------------
public init(text: String, public init(text: String,
textStyle: TextStyle = .BoldTitleSmall) { textStyle: TextStyle = .BoldTitleSmall) {
self.text = text self.text = text
self.textStyle = textStyle self.textStyle = textStyle
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Functions // MARK: - Public Functions
//-------------------------------------------------- //--------------------------------------------------
public func toTitleLockupTitleModel() -> TitleLockup.TitleModel { public func toTitleLockupTitleModel() -> TitleLockup.TitleModel {
TitleLockup.TitleModel(text: text, TitleLockup.TitleModel(text: text,
textAttributes: nil, textAttributes: nil,
textStyle: textStyle.value) textStyle: textStyle.value)
}
} }
} }