37 lines
1.0 KiB
Swift
37 lines
1.0 KiB
Swift
//
|
|
// RadioSwatchGroupModel.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 8/25/22.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public protocol RadioSwatchGroupModel: SelectorGroupSelectedModelable, Equatable where SelectorModelType: RadioSwatchModel { }
|
|
|
|
extension RadioSwatchGroupModel {
|
|
public var labelModel: DefaultLabelModel {
|
|
var model = DefaultLabelModel()
|
|
model.textPosition = .left
|
|
model.typograpicalStyle = .BodySmall
|
|
model.text = selectedModel?.text ?? " "
|
|
model.surface = surface
|
|
model.disabled = disabled
|
|
return model
|
|
}
|
|
}
|
|
|
|
public struct DefaultRadioSwatchGroupModel: RadioSwatchGroupModel {
|
|
public typealias SelectorModelType = DefaultRadioSwatchModel
|
|
public var inputId: String?
|
|
public var value: AnyHashable?
|
|
public var surface: Surface = .light
|
|
public var disabled: Bool = false
|
|
public var selectors: [SelectorModelType]
|
|
public var selectedInputId: String?
|
|
public init() { selectors = [] }
|
|
public init(selectors: [SelectorModelType]){
|
|
self.selectors = selectors
|
|
}
|
|
}
|