refactored to use models
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
74a2e0349e
commit
510a07e394
@ -60,19 +60,19 @@ class CheckboxGroupViewController: BaseViewController {
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
let checkbox1 = Checkbox()
|
||||
var checkbox1 = CheckboxGroup.CheckboxModel()
|
||||
checkbox1.inputId = "model1"
|
||||
checkbox1.value = "model 1 Value"
|
||||
checkbox1.labelText = "iPhone 11 Bundle 1"
|
||||
checkbox1.childText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
|
||||
|
||||
let checkbox2 = Checkbox()
|
||||
var checkbox2 = CheckboxGroup.CheckboxModel()
|
||||
checkbox2.inputId = "model2"
|
||||
checkbox2.value = "model 2 Value"
|
||||
checkbox2.labelText = "iPhone 11 Bundle 2"
|
||||
checkbox2.childText = "Apple iPhone 11 - 128 GB\nOtterbox Case Black\nScreen Protector"
|
||||
|
||||
checkboxGroup.selectorViews = [checkbox1, checkbox2]
|
||||
checkboxGroup.setSelectorViewModels(models: [checkbox1, checkbox2])
|
||||
|
||||
checkboxGroup.onChange = { [weak self] group in
|
||||
let selected = group.selectedHandlers?
|
||||
|
||||
@ -70,21 +70,21 @@ class RadioBoxGroupViewController: BaseViewController {
|
||||
|
||||
func setupModel(){
|
||||
|
||||
let radioBox1 = RadioBox()
|
||||
var radioBox1 = RadioBoxGroup.RadioBoxModel()
|
||||
radioBox1.inputId = "model1"
|
||||
radioBox1.isSelected = true
|
||||
radioBox1.selected = true
|
||||
radioBox1.value = "model 1 Value"
|
||||
radioBox1.text = "iPhone 11 Bundle 1"
|
||||
radioBox1.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
|
||||
radioBox1.subTextRight = "Right Text"
|
||||
|
||||
let radioBox2 = RadioBox()
|
||||
var radioBox2 = RadioBoxGroup.RadioBoxModel()
|
||||
radioBox2.inputId = "model2"
|
||||
radioBox2.value = "model 2 Value"
|
||||
radioBox2.text = "iPhone 11 Bundle 2"
|
||||
radioBox2.subText = "Apple iPhone 11 - 128 GB\nOtterbox Case Black\nScreen Protector"
|
||||
|
||||
radioBoxGroup.selectorViews = [radioBox1, radioBox2]
|
||||
radioBoxGroup.setSelectorViewModels(models: [radioBox1, radioBox2])
|
||||
|
||||
radioBoxGroup
|
||||
.publisher(for: .valueChanged)
|
||||
|
||||
@ -61,25 +61,25 @@ class RadioButtonViewController: BaseViewController {
|
||||
}
|
||||
|
||||
func setupModel(){
|
||||
let radioButton1 = RadioButton()
|
||||
var radioButton1 = RadioButtonGroup.RadioButtonModel()
|
||||
radioButton1.inputId = "model1"
|
||||
radioButton1.value = "model 1 Value"
|
||||
radioButton1.labelText = "iPhone 11 Bundle 1"
|
||||
radioButton1.childText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
|
||||
|
||||
let radioButton2 = RadioButton()
|
||||
var radioButton2 = RadioButtonGroup.RadioButtonModel()
|
||||
radioButton2.inputId = "model2"
|
||||
radioButton2.value = "model 2 Value"
|
||||
radioButton2.labelText = "iPhone 11 Bundle 2"
|
||||
radioButton2.childText = "Apple iPhone 11 - 128 GB\nOtterbox Case Black\nScreen Protector"
|
||||
|
||||
let radioButton3 = RadioButton()
|
||||
var radioButton3 = RadioButtonGroup.RadioButtonModel()
|
||||
radioButton3.inputId = "model3"
|
||||
radioButton3.value = "model 3 Value"
|
||||
radioButton3.labelText = "iPhone 11 Bundle 3"
|
||||
radioButton3.childText = "Apple iPhone 11 - 256 GB\nOtterbox Case Black\nScreen Protector"
|
||||
|
||||
radioButtonGroup.selectorViews = [radioButton1, radioButton2, radioButton3]
|
||||
radioButtonGroup.setSelectorViewModels(models: [radioButton1, radioButton2, radioButton3])
|
||||
|
||||
radioButtonGroup.onChange = { [weak self] group in
|
||||
let alertController:UIAlertController = UIAlertController(title: "Alert",
|
||||
|
||||
@ -42,48 +42,48 @@ class RadioSwatchGroupViewController: BaseViewController {
|
||||
|
||||
func setupModel(){
|
||||
|
||||
let radioSwatch1 = RadioSwatch()
|
||||
var radioSwatch1 = RadioSwatchGroup.RadioSwatchModel()
|
||||
radioSwatch1.fillImage = UIImage(named: "imageSwatch")
|
||||
radioSwatch1.text = "Image"
|
||||
radioSwatch1.inputId = "radioSwatch1"
|
||||
|
||||
let radioSwatch2 = RadioSwatch()
|
||||
var radioSwatch2 = RadioSwatchGroup.RadioSwatchModel()
|
||||
radioSwatch2.primaryColor = .red
|
||||
radioSwatch2.secondaryColor = .blue
|
||||
radioSwatch2.text = "Red/Blue"
|
||||
radioSwatch2.inputId = "radioSwatch2"
|
||||
|
||||
let radioSwatch3 = RadioSwatch()
|
||||
var radioSwatch3 = RadioSwatchGroup.RadioSwatchModel()
|
||||
radioSwatch3.primaryColor = .green
|
||||
radioSwatch3.text = "Green"
|
||||
radioSwatch3.inputId = "radioSwatch3"
|
||||
|
||||
let radioSwatch4 = RadioSwatch()
|
||||
var radioSwatch4 = RadioSwatchGroup.RadioSwatchModel()
|
||||
radioSwatch4.primaryColor = .orange
|
||||
radioSwatch4.text = "Orange"
|
||||
radioSwatch4.inputId = "radioSwatch4"
|
||||
|
||||
let radioSwatch5 = RadioSwatch()
|
||||
var radioSwatch5 = RadioSwatchGroup.RadioSwatchModel()
|
||||
radioSwatch5.primaryColor = .brown
|
||||
radioSwatch5.text = "Brown"
|
||||
radioSwatch5.inputId = "radioSwatch5"
|
||||
|
||||
let radioSwatch6 = RadioSwatch()
|
||||
var radioSwatch6 = RadioSwatchGroup.RadioSwatchModel()
|
||||
radioSwatch6.primaryColor = .yellow
|
||||
radioSwatch6.text = "Yellow"
|
||||
radioSwatch6.inputId = "radioSwatch6"
|
||||
|
||||
let radioSwatch7 = RadioSwatch()
|
||||
var radioSwatch7 = RadioSwatchGroup.RadioSwatchModel()
|
||||
radioSwatch7.primaryColor = .purple
|
||||
radioSwatch7.text = "Puple"
|
||||
radioSwatch7.inputId = "radioSwatch7"
|
||||
|
||||
let radioSwatch8 = RadioSwatch()
|
||||
var radioSwatch8 = RadioSwatchGroup.RadioSwatchModel()
|
||||
radioSwatch8.primaryColor = .systemPink
|
||||
radioSwatch8.text = "Pink"
|
||||
radioSwatch8.inputId = "radioSwatch8"
|
||||
|
||||
radioSwatchGroup.selectorViews = [radioSwatch1, radioSwatch2, radioSwatch3, radioSwatch4, radioSwatch5, radioSwatch6, radioSwatch7, radioSwatch8]
|
||||
radioSwatchGroup.setSelectorViewModels(models: [radioSwatch1, radioSwatch2, radioSwatch3, radioSwatch4, radioSwatch5, radioSwatch6, radioSwatch7, radioSwatch8])
|
||||
|
||||
radioSwatchGroup.onChange = { group in
|
||||
print("Selected: \(group.selectedHandler?.text ?? "none")")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user