moved default models

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-07-30 09:20:01 -05:00
parent 5de60eef0f
commit 831f4baf18
2 changed files with 10 additions and 10 deletions

View File

@ -10,15 +10,6 @@ import UIKit
import VDSColorTokens
import Combine
open class DefaultLabelModel: VDSLabelModel {
public var fontCategory: VDSFontCategory = .body
public var fontSize: VDSFontSize = .large
public var fontWeight: VDSFontWeight = .regular
public var textPosition: VDSTextPosition = .left
public var surface: Surface = .light
required public init(){}
}
open class VDSLabel: UILabel, Modelable {
@Published public var model: VDSLabelModel = DefaultLabelModel()
private var cancellable: AnyCancellable?
@ -53,7 +44,7 @@ open class VDSLabel: UILabel, Modelable {
setup()
}
func setup() {
private func setup() {
cancellable = $model.debounce(for: .seconds(ModelStateDebounce), scheduler: RunLoop.main).sink { [weak self] viewModel in
self?.onStateChange(viewModel: viewModel)
}

View File

@ -10,3 +10,12 @@ import UIKit
public protocol VDSLabelModel: Labelable, Surfaceable {
}
open class DefaultLabelModel: VDSLabelModel {
public var fontCategory: VDSFontCategory = .body
public var fontSize: VDSFontSize = .large
public var fontWeight: VDSFontWeight = .regular
public var textPosition: VDSTextPosition = .left
public var surface: Surface = .light
required public init(){}
}