added Identifiable to LabelAttributeModel

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-09-15 13:59:51 -05:00
parent e07f855eb6
commit a561ea30d8
11 changed files with 23 additions and 18 deletions

View File

@ -10,9 +10,9 @@ import UIKit
public protocol CheckboxModel: Modelable, FormFieldable, Errorable, DataTrackable, Accessable, Selectable, BinaryColorable {
var labelText: String? { get set }
var labelTextAttributes: [LabelAttributeModel]? { get set }
var labelTextAttributes: [any LabelAttributeModel]? { get set }
var childText: String? { get set }
var childTextAttributes: [LabelAttributeModel]? { get set }
var childTextAttributes: [any LabelAttributeModel]? { get set }
}
extension CheckboxModel {
@ -67,9 +67,9 @@ public struct DefaultCheckboxModel: CheckboxModel {
public var id = UUID()
public var selected: Bool = false
public var labelText: String?
public var labelTextAttributes: [LabelAttributeModel]?
public var labelTextAttributes: [any LabelAttributeModel]?
public var childText: String?
public var childTextAttributes: [LabelAttributeModel]?
public var childTextAttributes: [any LabelAttributeModel]?
public var hasError: Bool = false
public var errorText: String?

View File

@ -18,6 +18,7 @@ public struct LabelAttributeActionModel: LabelAttributeActionable {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public var id = UUID()
public var location: Int
public var length: Int
public var action = PassthroughSubject<Void, Never>()

View File

@ -12,6 +12,7 @@ public struct LabelAttributeColor: LabelAttributeModel {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public var id = UUID()
public var location: Int
public var length: Int
public var color: UIColor

View File

@ -12,6 +12,7 @@ public struct LabelAttributeFont: LabelAttributeModel {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public var id = UUID()
public var location: Int
public var length: Int
public var style: TypographicalStyle

View File

@ -8,7 +8,7 @@
import Foundation
import UIKit
public protocol LabelAttributeModel {
public protocol LabelAttributeModel: Identifiable where ID == UUID {
var location: Int { get set }
var length: Int { get set }
func setAttribute(on attributedString: NSMutableAttributedString)

View File

@ -9,6 +9,7 @@ import Foundation
import UIKit
public struct LabelAttributeStrikeThrough: LabelAttributeModel {
public var id = UUID()
public var location: Int
public var length: Int

View File

@ -9,6 +9,7 @@ import Foundation
import UIKit
public struct LabelAttributeUnderline: LabelAttributeModel {
public var id = UUID()
public var location: Int
public var length: Int
public var color: UIColor?

View File

@ -47,7 +47,7 @@ open class LabelBase<ModelType: LabelModel>: UILabel, ModelHandlerable, ViewProt
}
@Proxy(\.model.attributes)
open var attributes: [LabelAttributeModel]?
open var attributes: [any LabelAttributeModel]?
@Proxy(\.model.typograpicalStyle)
open var typograpicalStyle: TypographicalStyle

View File

@ -10,13 +10,13 @@ import UIKit
public protocol LabelModel: Modelable, Labelable {
var text: String? { get set }
var attributes: [LabelAttributeModel]? { get set }
var attributes: [any LabelAttributeModel]? { get set }
}
public struct DefaultLabelModel: LabelModel {
public var id = UUID()
public var text: String?
public var attributes: [LabelAttributeModel]?
public var attributes: [any LabelAttributeModel]?
public var typograpicalStyle: TypographicalStyle = .BodySmall
public var textPosition: TextPosition = .left
public var surface: Surface = .light

View File

@ -10,11 +10,11 @@ import UIKit
public protocol RadioBoxModel: Modelable, FormFieldable, DataTrackable, Accessable, Selectable, BinaryColorable {
var text: String { get set }
var textAttributes: [LabelAttributeModel]? { get set }
var textAttributes: [any LabelAttributeModel]? { get set }
var subText: String? { get set }
var subTextAttributes: [LabelAttributeModel]? { get set }
var subTextAttributes: [any LabelAttributeModel]? { get set }
var subTextRight: String? { get set }
var subTextRightAttributes: [LabelAttributeModel]? { get set }
var subTextRightAttributes: [any LabelAttributeModel]? { get set }
var strikethrough: Bool { get set }
}
@ -61,11 +61,11 @@ public struct DefaultRadioBoxModel: RadioBoxModel {
public var id = UUID()
public var selected: Bool = false
public var text: String = "Default Text"
public var textAttributes: [LabelAttributeModel]?
public var textAttributes: [any LabelAttributeModel]?
public var subText: String?
public var subTextAttributes: [LabelAttributeModel]?
public var subTextAttributes: [any LabelAttributeModel]?
public var subTextRight: String?
public var subTextRightAttributes: [LabelAttributeModel]?
public var subTextRightAttributes: [any LabelAttributeModel]?
public var selectedAccentColor: UIColor?
public var strikethrough: Bool = false

View File

@ -10,9 +10,9 @@ import UIKit
public protocol RadioButtonModel: Modelable, FormFieldable, Errorable, DataTrackable, Accessable, Selectable, BinaryColorable {
var labelText: String? { get set }
var labelTextAttributes: [LabelAttributeModel]? { get set }
var labelTextAttributes: [any LabelAttributeModel]? { get set }
var childText: String? { get set }
var childTextAttributes: [LabelAttributeModel]? { get set }
var childTextAttributes: [any LabelAttributeModel]? { get set }
}
extension RadioButtonModel {
@ -68,9 +68,9 @@ public struct DefaultRadioButtonModel: RadioButtonModel {
public var selected: Bool = false
public var labelText: String?
public var labelTextAttributes: [LabelAttributeModel]?
public var labelTextAttributes: [any LabelAttributeModel]?
public var childText: String?
public var childTextAttributes: [LabelAttributeModel]?
public var childTextAttributes: [any LabelAttributeModel]?
public var hasError: Bool = false
public var errorText: String?