From 510a07e3943765be9e397136845ecb78fe25d410 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 26 Apr 2023 16:12:29 -0500 Subject: [PATCH 1/3] refactored to use models Signed-off-by: Matt Bruce --- .../CheckBoxGroupViewController.swift | 6 +++--- .../RadioBoxGroupViewController.swift | 8 ++++---- .../RadioButtonViewController.swift | 8 ++++---- .../RadioSwatchGroupViewController.swift | 18 +++++++++--------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/VDSSample/ViewControllers/CheckBoxGroupViewController.swift b/VDSSample/ViewControllers/CheckBoxGroupViewController.swift index d5bd556..7f88632 100644 --- a/VDSSample/ViewControllers/CheckBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/CheckBoxGroupViewController.swift @@ -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? diff --git a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift index 2af776e..f30a321 100644 --- a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift @@ -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) diff --git a/VDSSample/ViewControllers/RadioButtonViewController.swift b/VDSSample/ViewControllers/RadioButtonViewController.swift index ec87dcc..1890e45 100644 --- a/VDSSample/ViewControllers/RadioButtonViewController.swift +++ b/VDSSample/ViewControllers/RadioButtonViewController.swift @@ -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", diff --git a/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift b/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift index 5d969d1..a3a5675 100644 --- a/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift @@ -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")") From a8b40e3ff026be42e4590ca7eef2db174b31c712 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 26 Apr 2023 16:13:35 -0500 Subject: [PATCH 2/3] removed paths Signed-off-by: Matt Bruce --- VDS.xcworkspace/contents.xcworkspacedata | 176 ----------------------- 1 file changed, 176 deletions(-) diff --git a/VDS.xcworkspace/contents.xcworkspacedata b/VDS.xcworkspace/contents.xcworkspacedata index 267889d..91951bf 100644 --- a/VDS.xcworkspace/contents.xcworkspacedata +++ b/VDS.xcworkspace/contents.xcworkspacedata @@ -4,182 +4,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 2c64c6232944ae1d779c39662eb50510d8f2304b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 26 Apr 2023 17:00:18 -0500 Subject: [PATCH 3/3] updated selectors Signed-off-by: Matt Bruce --- VDSSample/ViewControllers/CheckBoxGroupViewController.swift | 2 +- VDSSample/ViewControllers/RadioBoxGroupViewController.swift | 2 +- VDSSample/ViewControllers/RadioButtonViewController.swift | 2 +- VDSSample/ViewControllers/RadioSwatchGroupViewController.swift | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/VDSSample/ViewControllers/CheckBoxGroupViewController.swift b/VDSSample/ViewControllers/CheckBoxGroupViewController.swift index 7f88632..bae643a 100644 --- a/VDSSample/ViewControllers/CheckBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/CheckBoxGroupViewController.swift @@ -72,7 +72,7 @@ class CheckboxGroupViewController: BaseViewController { checkbox2.labelText = "iPhone 11 Bundle 2" checkbox2.childText = "Apple iPhone 11 - 128 GB\nOtterbox Case Black\nScreen Protector" - checkboxGroup.setSelectorViewModels(models: [checkbox1, checkbox2]) + checkboxGroup.selectorModels = [checkbox1, checkbox2] checkboxGroup.onChange = { [weak self] group in let selected = group.selectedHandlers? diff --git a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift index f30a321..6b833ff 100644 --- a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift @@ -84,7 +84,7 @@ class RadioBoxGroupViewController: BaseViewController { radioBox2.text = "iPhone 11 Bundle 2" radioBox2.subText = "Apple iPhone 11 - 128 GB\nOtterbox Case Black\nScreen Protector" - radioBoxGroup.setSelectorViewModels(models: [radioBox1, radioBox2]) + radioBoxGroup.selectorModels = [radioBox1, radioBox2] radioBoxGroup .publisher(for: .valueChanged) diff --git a/VDSSample/ViewControllers/RadioButtonViewController.swift b/VDSSample/ViewControllers/RadioButtonViewController.swift index 1890e45..c45035a 100644 --- a/VDSSample/ViewControllers/RadioButtonViewController.swift +++ b/VDSSample/ViewControllers/RadioButtonViewController.swift @@ -79,7 +79,7 @@ class RadioButtonViewController: BaseViewController { radioButton3.labelText = "iPhone 11 Bundle 3" radioButton3.childText = "Apple iPhone 11 - 256 GB\nOtterbox Case Black\nScreen Protector" - radioButtonGroup.setSelectorViewModels(models: [radioButton1, radioButton2, radioButton3]) + radioButtonGroup.selectorModels = [radioButton1, radioButton2, radioButton3] radioButtonGroup.onChange = { [weak self] group in let alertController:UIAlertController = UIAlertController(title: "Alert", diff --git a/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift b/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift index a3a5675..e364330 100644 --- a/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioSwatchGroupViewController.swift @@ -83,7 +83,7 @@ class RadioSwatchGroupViewController: BaseViewController { radioSwatch8.text = "Pink" radioSwatch8.inputId = "radioSwatch8" - radioSwatchGroup.setSelectorViewModels(models: [radioSwatch1, radioSwatch2, radioSwatch3, radioSwatch4, radioSwatch5, radioSwatch6, radioSwatch7, radioSwatch8]) + radioSwatchGroup.selectorModels = [radioSwatch1, radioSwatch2, radioSwatch3, radioSwatch4, radioSwatch5, radioSwatch6, radioSwatch7, radioSwatch8] radioSwatchGroup.onChange = { group in print("Selected: \(group.selectedHandler?.text ?? "none")")