diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 67dc070..cc1099f 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -46,18 +46,19 @@ EAF7F0CA289DA24F00B287F5 /* ArtifactoryItems.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F0C5289DA24F00B287F5 /* ArtifactoryItems.txt */; }; EAF7F0CC289DA24F00B287F5 /* DownloadArtifactoryItems.sh in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F0C8289DA24F00B287F5 /* DownloadArtifactoryItems.sh */; }; EAF7F0CD289DA24F00B287F5 /* Artifactory.sh in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F0C9289DA24F00B287F5 /* Artifactory.sh */; }; - EAF7F0F6289DB12E00B287F5 /* VDS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0F5289DB12E00B287F5 /* VDS.framework */; }; - EAF7F0F7289DB12E00B287F5 /* VDS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0F5289DB12E00B287F5 /* VDS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - EAF7F0FD289DB1D400B287F5 /* VDSFormControlsTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0DB289DB0B400B287F5 /* VDSFormControlsTokens.xcframework */; }; - EAF7F0FE289DB1D400B287F5 /* VDSFormControlsTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0DB289DB0B400B287F5 /* VDSFormControlsTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - EAF7F0FF289DB1D400B287F5 /* VDSTypographyTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0DA289DB0B400B287F5 /* VDSTypographyTokens.xcframework */; }; - EAF7F100289DB1D400B287F5 /* VDSTypographyTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0DA289DB0B400B287F5 /* VDSTypographyTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - EAF7F101289DB1D400B287F5 /* VDSLayoutTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0DD289DB0B400B287F5 /* VDSLayoutTokens.xcframework */; }; - EAF7F102289DB1D400B287F5 /* VDSLayoutTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0DD289DB0B400B287F5 /* VDSLayoutTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - EAF7F103289DB1D400B287F5 /* VDSColorTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0DC289DB0B400B287F5 /* VDSColorTokens.xcframework */; }; - EAF7F104289DB1D400B287F5 /* VDSColorTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0DC289DB0B400B287F5 /* VDSColorTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - EAF7F105289DB1D400B287F5 /* VDSAccessibilityTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0D9289DB0B400B287F5 /* VDSAccessibilityTokens.xcframework */; }; - EAF7F106289DB1D400B287F5 /* VDSAccessibilityTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0D9289DB0B400B287F5 /* VDSAccessibilityTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EAF7F108289DB90400B287F5 /* VDS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F107289DB90400B287F5 /* VDS.framework */; }; + EAF7F109289DB90400B287F5 /* VDS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F107289DB90400B287F5 /* VDS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EAF7F10A289DB93500B287F5 /* VDSTypographyTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA3C3BBA289968A0000CA526 /* VDSTypographyTokens.xcframework */; }; + EAF7F10B289DB93500B287F5 /* VDSTypographyTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA3C3BBA289968A0000CA526 /* VDSTypographyTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EAF7F10C289DB93500B287F5 /* VDSAccessibilityTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0D4289DA4A900B287F5 /* VDSAccessibilityTokens.xcframework */; }; + EAF7F10D289DB93500B287F5 /* VDSAccessibilityTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0D4289DA4A900B287F5 /* VDSAccessibilityTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EAF7F10E289DB93500B287F5 /* VDSFormControlsTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA3C3BBB289968A0000CA526 /* VDSFormControlsTokens.xcframework */; }; + EAF7F10F289DB93500B287F5 /* VDSFormControlsTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA3C3BBB289968A0000CA526 /* VDSFormControlsTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EAF7F110289DB93500B287F5 /* VDSColorTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA3C3BB9289968A0000CA526 /* VDSColorTokens.xcframework */; }; + EAF7F111289DB93500B287F5 /* VDSColorTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EA3C3BB9289968A0000CA526 /* VDSColorTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EAF7F112289DB93500B287F5 /* VDSLayoutTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0D3289DA4A900B287F5 /* VDSLayoutTokens.xcframework */; }; + EAF7F113289DB93500B287F5 /* VDSLayoutTokens.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EAF7F0D3289DA4A900B287F5 /* VDSLayoutTokens.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EAF7F11A28A14A0E00B287F5 /* RadioButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -67,12 +68,12 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - EAF7F0F7289DB12E00B287F5 /* VDS.framework in Embed Frameworks */, - EAF7F102289DB1D400B287F5 /* VDSLayoutTokens.xcframework in Embed Frameworks */, - EAF7F106289DB1D400B287F5 /* VDSAccessibilityTokens.xcframework in Embed Frameworks */, - EAF7F104289DB1D400B287F5 /* VDSColorTokens.xcframework in Embed Frameworks */, - EAF7F100289DB1D400B287F5 /* VDSTypographyTokens.xcframework in Embed Frameworks */, - EAF7F0FE289DB1D400B287F5 /* VDSFormControlsTokens.xcframework in Embed Frameworks */, + EAF7F10B289DB93500B287F5 /* VDSTypographyTokens.xcframework in Embed Frameworks */, + EAF7F109289DB90400B287F5 /* VDS.framework in Embed Frameworks */, + EAF7F111289DB93500B287F5 /* VDSColorTokens.xcframework in Embed Frameworks */, + EAF7F10D289DB93500B287F5 /* VDSAccessibilityTokens.xcframework in Embed Frameworks */, + EAF7F10F289DB93500B287F5 /* VDSFormControlsTokens.xcframework in Embed Frameworks */, + EAF7F113289DB93500B287F5 /* VDSLayoutTokens.xcframework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -108,6 +109,8 @@ EAF7F0DC289DB0B400B287F5 /* VDSColorTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSColorTokens.xcframework; path = SharedFrameworks/VDSColorTokens.xcframework; sourceTree = ""; }; EAF7F0DD289DB0B400B287F5 /* VDSLayoutTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSLayoutTokens.xcframework; path = SharedFrameworks/VDSLayoutTokens.xcframework; sourceTree = ""; }; EAF7F0F5289DB12E00B287F5 /* VDS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = VDS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + EAF7F107289DB90400B287F5 /* VDS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = VDS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioButtonViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -115,12 +118,12 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - EAF7F0F6289DB12E00B287F5 /* VDS.framework in Frameworks */, - EAF7F101289DB1D400B287F5 /* VDSLayoutTokens.xcframework in Frameworks */, - EAF7F105289DB1D400B287F5 /* VDSAccessibilityTokens.xcframework in Frameworks */, - EAF7F103289DB1D400B287F5 /* VDSColorTokens.xcframework in Frameworks */, - EAF7F0FF289DB1D400B287F5 /* VDSTypographyTokens.xcframework in Frameworks */, - EAF7F0FD289DB1D400B287F5 /* VDSFormControlsTokens.xcframework in Frameworks */, + EAF7F10A289DB93500B287F5 /* VDSTypographyTokens.xcframework in Frameworks */, + EAF7F108289DB90400B287F5 /* VDS.framework in Frameworks */, + EAF7F110289DB93500B287F5 /* VDSColorTokens.xcframework in Frameworks */, + EAF7F10C289DB93500B287F5 /* VDSAccessibilityTokens.xcframework in Frameworks */, + EAF7F10E289DB93500B287F5 /* VDSFormControlsTokens.xcframework in Frameworks */, + EAF7F112289DB93500B287F5 /* VDSLayoutTokens.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -160,6 +163,7 @@ EA3C3BB8289968A0000CA526 /* Frameworks */ = { isa = PBXGroup; children = ( + EAF7F107289DB90400B287F5 /* VDS.framework */, EAF7F0F5289DB12E00B287F5 /* VDS.framework */, EAF7F0D4289DA4A900B287F5 /* VDSAccessibilityTokens.xcframework */, EAF7F0D3289DA4A900B287F5 /* VDSLayoutTokens.xcframework */, @@ -199,9 +203,10 @@ EAF7F07F28996A1900B287F5 /* ViewControllers */ = { isa = PBXGroup; children = ( - EA3C3BB228996775000CA526 /* MenuViewController.swift */, - EA3C3BB328996775000CA526 /* ToggleViewController.swift */, EAF7F09B2899B92400B287F5 /* CheckboxViewController.swift */, + EA3C3BB228996775000CA526 /* MenuViewController.swift */, + EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */, + EA3C3BB328996775000CA526 /* ToggleViewController.swift */, ); path = ViewControllers; sourceTree = ""; @@ -350,6 +355,7 @@ EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */, EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */, EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */, + EAF7F11A28A14A0E00B287F5 /* RadioButtonViewController.swift in Sources */, EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */, EA3C3BB428996775000CA526 /* PickerBase.swift in Sources */, EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */, diff --git a/VDSSample.xcodeproj/xcuserdata/mattbruce.xcuserdatad/xcschemes/xcschememanagement.plist b/VDSSample.xcodeproj/xcuserdata/mattbruce.xcuserdatad/xcschemes/xcschememanagement.plist index c70fb91..3d45963 100644 --- a/VDSSample.xcodeproj/xcuserdata/mattbruce.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/VDSSample.xcodeproj/xcuserdata/mattbruce.xcuserdatad/xcschemes/xcschememanagement.plist @@ -19,10 +19,15 @@ orderHint 3 + VDS Artifactory.xcscheme_^#shared#^_ + + orderHint + 7 + VDSSample.xcscheme_^#shared#^_ orderHint - 0 + 6 SuppressBuildableAutocreation diff --git a/VDSSample/Supporting Files/Resources/Components.storyboard b/VDSSample/Supporting Files/Resources/Components.storyboard index 2968df4..a6f4b71 100644 --- a/VDSSample/Supporting Files/Resources/Components.storyboard +++ b/VDSSample/Supporting Files/Resources/Components.storyboard @@ -468,6 +468,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index cb065d0..675ab9b 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -16,7 +16,8 @@ struct MenuComponent { class MenuViewController: UITableViewController { let items: [MenuComponent] = [ MenuComponent(title: "Toggle", viewController: ToggleViewController.self), - MenuComponent(title: "Checkbox", viewController: CheckboxViewController.self) + MenuComponent(title: "Checkbox", viewController: CheckboxViewController.self), + MenuComponent(title: "RadioButton", viewController: RadioButtonViewController.self) ] override func numberOfSections(in tableView: UITableView) -> Int { diff --git a/VDSSample/ViewControllers/RadioButtonViewController.swift b/VDSSample/ViewControllers/RadioButtonViewController.swift new file mode 100644 index 0000000..0dc4666 --- /dev/null +++ b/VDSSample/ViewControllers/RadioButtonViewController.swift @@ -0,0 +1,120 @@ +// +// RadioButtonViewController.swift +// VDSSample +// +// Created by Matt Bruce on 8/1/22. +// + +import Foundation +import UIKit +import VDS +import VDSColorTokens + +class RadioButtonViewController: UIViewController, StoryboardInitable { + enum PickerType { + case surface + } + static var storyboardId: String = "radioButton" + static var storyboardName: String = "Components" + + @IBOutlet weak var componentContainerView: UIView! + @IBOutlet weak var picker: UIPickerView! + @IBOutlet weak var surfaceLabel: UILabel! + + @IBOutlet weak var disabledSwitch: UISwitch! + @IBOutlet weak var labelTextField: UITextField! + @IBOutlet weak var childTextField: UITextField! + @IBOutlet weak var showErrorSwitch: UISwitch! + @IBOutlet weak var errorTextField: UITextField! + + var radioButton: RadioButton! + + override func viewDidLoad() { + super.viewDidLoad() + var model = DefaultRadioButtonModel() + model.labelText = "Terms and conditions" + model.childText = "I agree to Verizon's terms and conditions click here" + model.childTextAttributes = [ + LabelAttributeUnderline(location: 11, length: 10), + LabelAttributeStrikeThrough(location: 22, length: 5), + LabelAttributeColor(location: 31, length: 10, color: UIColor.blue.hexString!), + LabelAttributeActionModel(location: 31, length: 10){ print("clicked on the word 'conditions'") }, + LabelAttributeFont(location: 2, length: 5, style: .BoldTitleLarge, color: UIColor.red.hexString!) + ] + model.errorText = "Error Text" + + surfaceLabel.text = model.surface.rawValue + disabledSwitch.isOn = model.on + labelTextField.text = model.labelText + childTextField.text = model.childText + showErrorSwitch.isOn = model.showError + errorTextField.text = model.errorText + + radioButton = RadioButton(with: model) + radioButton.translatesAutoresizingMaskIntoConstraints = false + componentContainerView.addSubview(radioButton) + radioButton.leadingAnchor.constraint(equalTo: componentContainerView.leadingAnchor, constant: 10).isActive = true + radioButton.bottomAnchor.constraint(equalTo: componentContainerView.bottomAnchor, constant: -20).isActive = true + radioButton.topAnchor.constraint(equalTo: componentContainerView.topAnchor, constant: 20).isActive = true + radioButton.trailingAnchor.constraint(equalTo: componentContainerView.trailingAnchor, constant: 10).isActive = true + view.addGestureRecognizer(UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing(_:)))) + setupPicker() + } + + @IBAction func disabledChanged(_ sender: UISwitch) { + radioButton.disabled = sender.isOn + } + + @IBAction func onLabelTextDidEnd(_ sender: UITextField) { + radioButton.labelText = sender.text + sender.resignFirstResponder() + } + + @IBAction func onChildTextDidEnd(_ sender: UITextField) { + radioButton.childText = sender.text + sender.resignFirstResponder() + } + + @IBAction func showErrorChanged(_ sender: UISwitch) { + radioButton.showError = sender.isOn + } + + @IBAction func onErrorTextDidEnd(_ sender: UITextField) { + radioButton.errorText = sender.text + sender.resignFirstResponder() + } + + @IBAction func surfaceClick(_ sender: Any) { + pickerType = .surface + } + + //Picker + var surfacePicker = SurfacePicker() + + var pickerType: PickerType = .surface { + didSet { + func update(object: UIPickerViewDelegate & UIPickerViewDataSource){ + picker.delegate = object + picker.dataSource = object + } + + switch pickerType{ + case .surface: + update(object: surfacePicker) + } + picker.reloadAllComponents() + picker.selectRow(0, inComponent: 0, animated: false) + picker.isHidden = false + } + } + + func setupPicker(){ + picker.isHidden = true + surfacePicker.onPickerDidSelect = { item in + self.radioButton.surface = item + self.componentContainerView.backgroundColor = item.color + self.surfaceLabel.text = item.rawValue + } + } +} +