45 lines
1.3 KiB
Swift
45 lines
1.3 KiB
Swift
//
|
|
// VDSLabelModel.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 7/28/22.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
public protocol LabelModel: Modelable, Labelable {
|
|
var text: String? { get set }
|
|
var attributes: [any LabelAttributeModel]? { get set }
|
|
}
|
|
|
|
public struct DefaultLabelModel: LabelModel, AnyEquatable, Equatable {
|
|
public static func == (lhs: DefaultLabelModel, rhs: DefaultLabelModel) -> Bool {
|
|
lhs.isEqual(rhs)
|
|
}
|
|
|
|
public func isEqual(_ equatable: AnyEquatable) -> Bool {
|
|
guard let equatable = equatable as? Self else {
|
|
return false
|
|
}
|
|
|
|
return id == equatable.id
|
|
&& attributes == equatable.attributes
|
|
&& text == equatable.text
|
|
&& surface == equatable.surface
|
|
&& typograpicalStyle == equatable.typograpicalStyle
|
|
&& textPosition == equatable.textPosition
|
|
&& surface == equatable.surface
|
|
&& disabled == equatable.disabled
|
|
}
|
|
|
|
public var id = UUID()
|
|
public var text: String?
|
|
public var attributes: [any LabelAttributeModel]?
|
|
public var typograpicalStyle: TypographicalStyle = .BodySmall
|
|
public var textPosition: TextPosition = .left
|
|
public var surface: Surface = .light
|
|
public var disabled: Bool = false
|
|
public init(){}
|
|
}
|