diff --git a/VDSSample/Classes/TextField.swift b/VDSSample/Classes/TextField.swift index 0df3c00..20c57b8 100644 --- a/VDSSample/Classes/TextField.swift +++ b/VDSSample/Classes/TextField.swift @@ -11,7 +11,7 @@ import VDS import VDSFormControlsTokens import Combine -public class TextField: UITextField { +open class TextField: UITextField { public var resigner: AnyCancellable? public var resignAction: ((TextField) -> Void)? diff --git a/VDSSample/ViewControllers/BaseViewController.swift b/VDSSample/ViewControllers/BaseViewController.swift index 1449e03..910b407 100644 --- a/VDSSample/ViewControllers/BaseViewController.swift +++ b/VDSSample/ViewControllers/BaseViewController.swift @@ -300,6 +300,7 @@ public class BaseViewController: UIViewController, Initable , var activeTextField: UITextField? + /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open func setup() { if let textFields = allTextFields()?.filter({ $0.isKind(of: TextField.self) == false || $0.isKind(of: NumericField.self) }) { diff --git a/VDSSample/ViewControllers/ButtonGroupViewController.swift b/VDSSample/ViewControllers/ButtonGroupViewController.swift index ce8325e..034c9a8 100644 --- a/VDSSample/ViewControllers/ButtonGroupViewController.swift +++ b/VDSSample/ViewControllers/ButtonGroupViewController.swift @@ -48,9 +48,9 @@ class ButtonGroupViewController: BaseViewController { } lazy var buttonPositionSelectorView = { - PickerSelectorView(title: "", + PickerSelectorView(title: "", picker: self.picker, - items: ButtonGroup.ButtonPosition.allCases) + items: ButtonGroup.Alignment.allCases) }() lazy var rowQuantitySelectorView = { @@ -128,25 +128,25 @@ class ButtonGroupViewController: BaseViewController { .numberPublisher .sink { [weak self] number in if let number { - self?.component.buttonWidth = number.cgFloatValue - self?.smallButtonGroup.buttonWidth = number.cgFloatValue + self?.component.childWidth = .value(number.cgFloatValue) + self?.smallButtonGroup.childWidth = .value(number.cgFloatValue) self?.percentageTextField.text = "" } else { - self?.component.buttonWidth = nil + self?.component.childWidth = nil + self?.smallButtonGroup.childWidth = nil } }.store(in: &subscribers) percentageTextField .numberPublisher .sink { [weak self] number in - let rowQty = self?.component.rowQuantity ?? 0 - if let number, number.intValue <= 100, rowQty > 0 { - self?.component.buttonPercentage = number.cgFloatValue - self?.smallButtonGroup.buttonPercentage = number.cgFloatValue + if let number { + self?.component.childWidth = .percentage(number.cgFloatValue) + self?.smallButtonGroup.childWidth = .percentage(number.cgFloatValue) self?.widthTextField.text = "" } else { - self?.component.buttonPercentage = nil - self?.smallButtonGroup.buttonPercentage = nil + self?.component.childWidth = nil + self?.smallButtonGroup.childWidth = nil } }.store(in: &subscribers) @@ -155,7 +155,7 @@ class ButtonGroupViewController: BaseViewController { func setupModel() { //setup UI surfacePickerSelectorView.text = component.surface.rawValue - buttonPositionSelectorView.text = component.buttonPosition.rawValue + buttonPositionSelectorView.text = component.alignment.rawValue disabledSwitch.isOn = !component.isEnabled rowQuantitySelectorView.text = RowQuantity(quantity: component.rowQuantity).rawValue widthTextField.text = "" @@ -172,8 +172,8 @@ class ButtonGroupViewController: BaseViewController { } buttonPositionSelectorView.onPickerDidSelect = { [weak self] item in - self?.component.buttonPosition = item - self?.smallButtonGroup.buttonPosition = item + self?.component.alignment = item + self?.smallButtonGroup.alignment = item } rowQuantitySelectorView.onPickerDidSelect = { [weak self] item in @@ -184,8 +184,8 @@ class ButtonGroupViewController: BaseViewController { self?.percentageTextField.text = "" } else { self?.widthTextField.text = "" - self?.component.buttonWidth = nil - self?.smallButtonGroup.buttonWidth = nil + self?.component.childWidth = nil + self?.smallButtonGroup.childWidth = nil } if UIDevice.isIPad { diff --git a/VDSSample/ViewControllers/CheckBoxGroupViewController.swift b/VDSSample/ViewControllers/CheckBoxGroupViewController.swift index 4255972..d7643d0 100644 --- a/VDSSample/ViewControllers/CheckBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/CheckBoxGroupViewController.swift @@ -78,14 +78,14 @@ class CheckboxGroupViewController: BaseViewController { } func setupModel() { - var checkbox1 = CheckboxGroup.CheckboxModel() + var checkbox1 = CheckboxGroup.CheckboxItemModel() 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" checkbox1.errorText = "Please Choose 1" - var checkbox2 = CheckboxGroup.CheckboxModel() + var checkbox2 = CheckboxGroup.CheckboxItemModel() checkbox2.inputId = "model2" checkbox2.value = "model 2 Value" checkbox2.labelText = "iPhone 11 Bundle 2" @@ -122,14 +122,14 @@ extension CheckboxGroupViewController: ComponentSampleable { static func makeSample() -> ComponentSample { let component = Self.makeComponent() - var checkbox1 = CheckboxGroup.CheckboxModel() + var checkbox1 = CheckboxGroup.CheckboxItemModel() 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" checkbox1.errorText = "Please Choose 1" - var checkbox2 = CheckboxGroup.CheckboxModel() + var checkbox2 = CheckboxGroup.CheckboxItemModel() checkbox2.inputId = "model2" checkbox2.value = "model 2 Value" checkbox2.labelText = "iPhone 11 Bundle 2" diff --git a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift index 1c0b939..1c49ba6 100644 --- a/VDSSample/ViewControllers/RadioBoxGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioBoxGroupViewController.swift @@ -67,15 +67,15 @@ class RadioBoxGroupViewController: BaseViewController{ func setupModel(){ - var radioBox1 = RadioBoxGroup.RadioBoxModel() + var radioBox1 = RadioBoxGroup.RadioBoxItemModel() radioBox1.inputId = "model1" 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.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector" radioBox1.subTextRight = "Right Text" - var radioBox2 = RadioBoxGroup.RadioBoxModel() + var radioBox2 = RadioBoxGroup.RadioBoxItemModel() radioBox2.inputId = "model2" radioBox2.value = "model 2 Value" radioBox2.text = "iPhone 11 Bundle 2" @@ -115,7 +115,7 @@ extension RadioBoxGroupViewController: ComponentSampleable { static func makeSample() -> ComponentSample { let component = Self.makeComponent() - var radioBox1 = RadioBoxGroup.RadioBoxModel() + var radioBox1 = RadioBoxGroup.RadioBoxItemModel() radioBox1.inputId = "model1" radioBox1.selected = true radioBox1.value = "model 1 Value" @@ -123,7 +123,7 @@ extension RadioBoxGroupViewController: ComponentSampleable { radioBox1.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector" radioBox1.subTextRight = "Right Text" - var radioBox2 = RadioBoxGroup.RadioBoxModel() + var radioBox2 = RadioBoxGroup.RadioBoxItemModel() radioBox2.inputId = "model2" radioBox2.value = "model 2 Value" radioBox2.text = "iPhone 11 Bundle 2" diff --git a/VDSSample/ViewControllers/RadioButtonGroupViewController.swift b/VDSSample/ViewControllers/RadioButtonGroupViewController.swift index c1131ba..3d43478 100644 --- a/VDSSample/ViewControllers/RadioButtonGroupViewController.swift +++ b/VDSSample/ViewControllers/RadioButtonGroupViewController.swift @@ -58,19 +58,19 @@ class RadioButtonGroupViewController: BaseViewController { } func setupModel(){ - var radioButton1 = RadioButtonGroup.RadioButtonModel() + var radioButton1 = RadioButtonGroup.RadioButtonItemModel() 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" - var radioButton2 = RadioButtonGroup.RadioButtonModel() + var radioButton2 = RadioButtonGroup.RadioButtonItemModel() 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" - var radioButton3 = RadioButtonGroup.RadioButtonModel() + var radioButton3 = RadioButtonGroup.RadioButtonItemModel() radioButton3.inputId = "model3" radioButton3.value = "model 3 Value" radioButton3.labelText = "iPhone 11 Bundle 3" @@ -113,19 +113,19 @@ extension RadioButtonGroupViewController: ComponentSampleable { static func makeSample() -> ComponentSample { let component = Self.makeComponent() - var radioButton1 = RadioButtonGroup.RadioButtonModel() + var radioButton1 = RadioButtonGroup.RadioButtonItemModel() 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" - var radioButton2 = RadioButtonGroup.RadioButtonModel() + var radioButton2 = RadioButtonGroup.RadioButtonItemModel() 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" - var radioButton3 = RadioButtonGroup.RadioButtonModel() + var radioButton3 = RadioButtonGroup.RadioButtonItemModel() radioButton3.inputId = "model3" radioButton3.value = "model 3 Value" radioButton3.labelText = "iPhone 11 Bundle 3"