vds_ios/VDS/Components/RadioSwatch/RadioSwatchGroupModel.swift
Matt Bruce 4054695a6b worked on more changes for swatch
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2022-08-30 17:00:49 -05:00

37 lines
1.1 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 selectedModel: DefaultRadioSwatchModel?
public init() { selectors = [] }
public init(selectors: [SelectorModelType]){
self.selectors = selectors
}
}