added Toggle/ToggleItem

update Toggle in screens to not use a wrapper

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-07-19 09:41:28 -05:00
parent d52c1f989b
commit 4b03f39443
30 changed files with 211 additions and 134 deletions

View File

@ -38,6 +38,7 @@
EA0D1C2F2A66CFE900E5C127 /* CheckboxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */; };
EA0D1C312A673F3500E5C127 /* RadioButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0D1C302A673F3500E5C127 /* RadioButtonViewController.swift */; };
EA0D1C332A673FD400E5C127 /* RadioButtonItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0D1C322A673FD400E5C127 /* RadioButtonItemViewController.swift */; };
EA0D1C352A68180100E5C127 /* ToggleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0D1C342A68180100E5C127 /* ToggleViewController.swift */; };
EA0FC2C12912DC5500DF80B4 /* TextLinkCaretViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */; };
EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9C289966EF000CA526 /* AppDelegate.swift */; };
EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */; };
@ -46,7 +47,7 @@
EA3C3BB428996775000CA526 /* PickerBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3BB028996775000CA526 /* PickerBase.swift */; };
EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3BB128996775000CA526 /* StoryboardInitable.swift */; };
EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3BB228996775000CA526 /* MenuViewController.swift */; };
EA3C3BB728996775000CA526 /* ToggleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3BB328996775000CA526 /* ToggleViewController.swift */; };
EA3C3BB728996775000CA526 /* ToggleItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3BB328996775000CA526 /* ToggleItemViewController.swift */; };
EA4DB30428DCD25B00103EE3 /* BadgeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA4DB30328DCD25B00103EE3 /* BadgeViewController.swift */; };
EA596ABA2A16B2ED00300C4B /* TabsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA596AB92A16B2ED00300C4B /* TabsViewController.swift */; };
EA5E3050294D11540082B959 /* TileContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5E304F294D11540082B959 /* TileContainerViewController.swift */; };
@ -131,6 +132,7 @@
EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckboxViewController.swift; sourceTree = "<group>"; };
EA0D1C302A673F3500E5C127 /* RadioButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonViewController.swift; sourceTree = "<group>"; };
EA0D1C322A673FD400E5C127 /* RadioButtonItemViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonItemViewController.swift; sourceTree = "<group>"; };
EA0D1C342A68180100E5C127 /* ToggleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleViewController.swift; sourceTree = "<group>"; };
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLinkCaretViewController.swift; sourceTree = "<group>"; };
EA3C3B99289966EF000CA526 /* VDSSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VDSSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
EA3C3B9C289966EF000CA526 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -141,7 +143,7 @@
EA3C3BB028996775000CA526 /* PickerBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PickerBase.swift; sourceTree = "<group>"; };
EA3C3BB128996775000CA526 /* StoryboardInitable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardInitable.swift; sourceTree = "<group>"; };
EA3C3BB228996775000CA526 /* MenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = "<group>"; };
EA3C3BB328996775000CA526 /* ToggleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToggleViewController.swift; sourceTree = "<group>"; };
EA3C3BB328996775000CA526 /* ToggleItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToggleItemViewController.swift; sourceTree = "<group>"; };
EA4DB30328DCD25B00103EE3 /* BadgeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeViewController.swift; sourceTree = "<group>"; };
EA596AB92A16B2ED00300C4B /* TabsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsViewController.swift; sourceTree = "<group>"; };
EA5E304F294D11540082B959 /* TileContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TileContainerViewController.swift; sourceTree = "<group>"; };
@ -332,7 +334,8 @@
EA5E304F294D11540082B959 /* TileContainerViewController.swift */,
EA5E305B295111050082B959 /* TileletViewController.swift */,
EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */,
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
EA0D1C342A68180100E5C127 /* ToggleViewController.swift */,
EA3C3BB328996775000CA526 /* ToggleItemViewController.swift */,
EAB2375F29E88D5D00AABE9A /* TooltipViewController.swift */,
EAB2376B29E9E74900AABE9A /* TrailingTooltipLabelViewController.swift */,
);
@ -480,7 +483,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EA3C3BB728996775000CA526 /* ToggleViewController.swift in Sources */,
EA3C3BB728996775000CA526 /* ToggleItemViewController.swift in Sources */,
EA5E30552950EA6E0082B959 /* TitleLockupViewController.swift in Sources */,
EAB5FEEF2927E28400998C17 /* ButtonGroupViewController.swift in Sources */,
EA89204C28B66CE2006B9984 /* ScrollWrapperView.swift in Sources */,
@ -491,6 +494,7 @@
EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */,
EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */,
EA5E3050294D11540082B959 /* TileContainerViewController.swift in Sources */,
EA0D1C352A68180100E5C127 /* ToggleViewController.swift in Sources */,
445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */,
EAF7F11A28A14A0E00B287F5 /* RadioButtonGroupViewController.swift in Sources */,
EA89204628B66CE2006B9984 /* ScrollViewController.swift in Sources */,

View File

@ -83,12 +83,12 @@ class BadgeIndicatorViewController: BaseViewController<BadgeIndicator> {
addFormRow(label: "Vertical Padding", view: verticalPaddingTextField)
addFormRow(label: "Fill Color", view: fillColorPickerSelectorView)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Hide Border", view: .makeWrapper(for: hideBorderSwitch))
addFormRow(label: "Hide Border", view: hideBorderSwitch)
addFormRow(label: "Border Light", view: borderColorLightPickerSelectorView)
addFormRow(label: "Border Dark", view: borderColorDarkPickerSelectorView)
addFormRow(label: "Size", view: textSizePickerSelectorView)
dotForm.addFormRow(label: "Hide Dot", view: .makeWrapper(for: hideDotSwitch))
dotForm.addFormRow(label: "Hide Dot", view: hideDotSwitch)
dotForm.addFormRow(label: "Dot Size", view: dotSizeTextField)
numberedForm.addFormRow(label: "Leading Character", view: leadingCharacterTextField)
numberedForm.addFormRow(label: "Text", view: textField)

View File

@ -205,7 +205,7 @@ public class BaseViewController<Component: UIView>: UIViewController, Initable {
}
public func setupForm() {
addFormRow(label: "Show Bounds", view: .makeWrapper(for: debugViewSwitch))
addFormRow(label: "Show Bounds", view: debugViewSwitch)
}
public func scrollToBottom() {

View File

@ -112,7 +112,7 @@ class ButtonGroupViewController: BaseViewController<ButtonGroup> {
super.setupForm()
addFormRow(label: "Button Action", view: label)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Position", view: buttonPositionSelectorView)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "Row Quantity", view: rowQuantitySelectorView)

View File

@ -62,14 +62,14 @@ class ButtonIconViewController: BaseViewController<ButtonIcon> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Surface Type", view: surfaceTypePickerSelectorView)
addFormRow(label: "Size", view: sizePickerSelectorView)
addFormRow(label: "Kind", view: kindPickerSelectorView)
addFormRow(label: "Floating", view: .makeWrapper(for: floating))
addFormRow(label: "Hide Border", view: .makeWrapper(for: hideBorder))
addFormRow(label: "Fit To Icon", view: .makeWrapper(for: fitToIcon))
addFormRow(label: "Floating", view: floating)
addFormRow(label: "Hide Border", view: hideBorder)
addFormRow(label: "Fit To Icon", view: fitToIcon)
addFormRow(label: "Custom Size", view: customSizeField)
addFormRow(label: "Name", view: namePickerSelectorView)
addFormRow(label: "X Offset", view: centerX)

View File

@ -44,7 +44,7 @@ class ButtonViewController: BaseViewController<Button> {
addFormRow(label: "Button Action", view: label)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Use", view: usePickerSelectorView)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Text", view: textField)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "Size", view: buttonSizePickerSelectorView)

View File

@ -32,11 +32,11 @@ class CheckboxGroupViewController: BaseViewController<CheckboxGroup> {
override func setupForm() {
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Child Text", view: childTextField)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error", view: showErrorSwitch)
showErrorSwitch.onChange = { [weak self] sender in
self?.component.showError = sender.isOn

View File

@ -31,11 +31,11 @@ class CheckboxItemViewController: BaseViewController<CheckboxItem> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Child Text", view: childTextField)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error Text", view: errorTextField)
showErrorSwitch.onChange = { [weak self] sender in

View File

@ -30,9 +30,9 @@ class CheckboxViewController: BaseViewController<Checkbox> {
}
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error", view: showErrorSwitch)
showErrorSwitch.onChange = { [weak self] sender in
guard let self else { return }

View File

@ -42,15 +42,15 @@ class InputFieldViewController: BaseViewController<InputField> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Required", view: .makeWrapper(for: requiredSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Required", view: requiredSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Helper Text Placement", view: helperTextPlacementPickerSelectorView)
addFormRow(label: "Helper Text", view: helperTextField)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error Text", view: errorTextField)
addFormRow(label: "Success", view: .makeWrapper(for: showSuccessSwitch))
addFormRow(label: "Success", view: showSuccessSwitch)
addFormRow(label: "Success Text", view: successTextField)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)

View File

@ -55,8 +55,8 @@ class LabelViewController: BaseViewController<Label> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Bold", view: .makeWrapper(for: boldSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Bold", view: boldSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Text Position", view: textPositionPickerSelectorView)
addFormRow(label: "Font Category", view: fontCategoryPickerSelectorView)

View File

@ -24,10 +24,10 @@ class LoaderViewController: BaseViewController<Loader>, LoaderLaunchable {
override func setupForm() {
super.setupForm()
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Active", view: .makeWrapper(for: isActive))
addFormRow(label: "Active", view: isActive)
let fullScreen = FormSection().with { $0.title = "LoaderLaunchable (separate from Loader)" }
fullScreen.addFormRow(label: "presentLoader", view: .makeWrapper(for: isFullscreen))
fullScreen.addFormRow(label: "presentLoader", view: isFullscreen)
append(section: fullScreen)
isActive

View File

@ -106,6 +106,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
MenuComponent(title: "Tilelet", completed: false, viewController: TileletViewController.self),
MenuComponent(title: "TitleLockup", completed: true, viewController: TitleLockupViewController.self),
MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self),
MenuComponent(title: "ToggleItem", completed: true, viewController: ToggleItemViewController.self),
MenuComponent(title: "Tooltip", completed: true, viewController: TooltipViewController.self),
MenuComponent(title: "TrailingTooltipLabel", completed: true, viewController: TrailingTooltipLabelViewController.self),

View File

@ -32,9 +32,9 @@ class RadioBoxGroupViewController: BaseViewController<RadioBoxGroup>{
override func setupForm() {
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Strikethrough", view: .makeWrapper(for: strikeThroughSwitch))
addFormRow(label: "Strikethrough", view: strikeThroughSwitch)
addFormRow(label: "Text", view: textField)
addFormRow(label: "Sub Text", view: subTextField)
addFormRow(label: "Sub Text Right", view: subTextRightField)

View File

@ -30,11 +30,11 @@ class RadioButtonGroupViewController: BaseViewController<RadioButtonGroup> {
override func setupForm() {
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Child Text", view: childTextField)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error", view: showErrorSwitch)
showErrorSwitch.onChange = { [weak self] sender in
self?.component.showError = sender.isOn

View File

@ -31,11 +31,11 @@ class RadioButtonItemViewController: BaseViewController<RadioButtonItem> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Child Text", view: childTextField)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error Text", view: errorTextField)
showErrorSwitch.onChange = { [weak self] sender in

View File

@ -24,9 +24,9 @@ class RadioButtonViewController: BaseViewController<RadioButton> {
}
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error", view: showErrorSwitch)
showErrorSwitch.onChange = { [weak self] sender in
guard let self else { return }

View File

@ -26,9 +26,9 @@ class RadioSwatchGroupViewController: BaseViewController<RadioSwatchGroup> {
override func setupForm() {
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Strikethrough", view: .makeWrapper(for: strikeThroughSwitch))
addFormRow(label: "Strikethrough", view: strikeThroughSwitch)
disabledSwitch.onChange = { [weak self] sender in
self?.component.disabled = sender.isOn

View File

@ -61,8 +61,8 @@ class TabsContainerViewController: BaseViewController<TabsContainer> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Large Sample", view: .makeWrapper(for: sampleSwitch))
addFormRow(label: "Show Borderline", view: .makeWrapper(for: borderlineSwitch))
addFormRow(label: "Large Sample", view: sampleSwitch)
addFormRow(label: "Show Borderline", view: borderlineSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Size", view: sizePickerSelectorView)
@ -74,7 +74,7 @@ class TabsContainerViewController: BaseViewController<TabsContainer> {
}
//only in horizontal mode
horizontalOrientationFormStackView.addFormRow(label: "Fill Container", view: .makeWrapper(for: fillContainerSwitch))
horizontalOrientationFormStackView.addFormRow(label: "Fill Container", view: fillContainerSwitch)
horizontalOrientationFormStackView.addFormRow(label: "Indicator Position", view: indicatorPositionPickerSelectorView)
overflowRow = horizontalOrientationFormStackView.addFormRow(label: "Overflow", view: overflowPickerSelectorView)

View File

@ -54,8 +54,8 @@ class TabsViewController: BaseViewController<Tabs> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Large Sample", view: .makeWrapper(for: sampleSwitch))
addFormRow(label: "Show Borderline", view: .makeWrapper(for: borderlineSwitch))
addFormRow(label: "Large Sample", view: sampleSwitch)
addFormRow(label: "Show Borderline", view: borderlineSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Size", view: sizePickerSelectorView)
@ -64,7 +64,7 @@ class TabsViewController: BaseViewController<Tabs> {
}
//only in horizontal mode
horizontalOrientationFormStackView.addFormRow(label: "Fill Container", view: .makeWrapper(for: fillContainerSwitch))
horizontalOrientationFormStackView.addFormRow(label: "Fill Container", view: fillContainerSwitch)
horizontalOrientationFormStackView.addFormRow(label: "Indicator Position", view: indicatorPositionPickerSelectorView)
//overflowRow = horizontalOrientationFormStackView.addFormRow(label: "Overflow", view: overflowPickerSelectorView)

View File

@ -36,12 +36,12 @@ class TextAreaViewController: BaseViewController<TextArea> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Required", view: .makeWrapper(for: requiredSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Required", view: requiredSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Helper Text", view: helperTextField)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error Text", view: errorTextField)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)

View File

@ -36,7 +36,7 @@ class TextLinkCaretViewController: BaseViewController<TextLinkCaret> {
super.setupForm()
addFormRow(label: "Button Action", view: label)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Label", view: textField)
addFormRow(label: "Caret Position", view: caretPositionPickerSelectorView)

View File

@ -36,7 +36,7 @@ class TextLinkViewController: BaseViewController<TextLink> {
super.setupForm()
addFormRow(label: "Button Action", view: label)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Label", view: textField)
addFormRow(label: "Size", view: buttonSizePickerSelectorView)

View File

@ -63,7 +63,7 @@ class TileContainerViewController: BaseViewController<TileContainer> {
$0.text = "This object does NOT reflect normal \"surface\" changes, all properties are maually set"
})
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Clickable", view: .makeWrapper(for: clickableSwitch))
addFormRow(label: "Clickable", view: clickableSwitch)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "Height", view: heightTextField)
addFormRow(label: "Show Border", view: showBorderSwitch)
@ -71,7 +71,7 @@ class TileContainerViewController: BaseViewController<TileContainer> {
addFormRow(label: "Background Color", view: backgroundColorPickerSelectorView)
addFormRow(label: "Padding", view: paddingPickerSelectorView)
addFormRow(label: "Aspect Ratio", view: scalingTypePickerSelectorView)
addFormRow(label: "Background Image", view: .makeWrapper(for: showBackgroundImageSwitch))
addFormRow(label: "Background Image", view: showBackgroundImageSwitch)
addFormRow(label: "Image Fallback Color", view: imageFallbackColorPickerSelectorView)
clickableSwitch.onChange = { [weak self] sender in

View File

@ -57,7 +57,7 @@ class TileletViewController: BaseViewController<Tilelet> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Clickable", view: .makeWrapper(for: clickableSwitch))
addFormRow(label: "Clickable", view: clickableSwitch)
addFormRow(label: "Title Style", view: titleStandardStylePickerSelectorView)
addFormRow(label: "Other Style", view: otherStandardStylePickerSelectorView)
@ -70,8 +70,8 @@ class TileletViewController: BaseViewController<Tilelet> {
addFormRow(label: "Text Width", view: textWidthTextField)
addFormRow(label: "Text Percentage", view: textPercentageTextField)
addFormRow(label: "Badge Text", view: badgeTextField)
addFormRow(label: "Description Icon", view: .makeWrapper(for: showDescriptionIconSwitch))
addFormRow(label: "Directional Icon", view: .makeWrapper(for: showDirectionalIconSwitch))
addFormRow(label: "Description Icon", view: showDescriptionIconSwitch)
addFormRow(label: "Directional Icon", view: showDirectionalIconSwitch)
clickableSwitch.onChange = { [weak self] sender in
guard let self else { return }

View File

@ -57,8 +57,8 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Text Position", view: textPositionPickerSelectorView)
addFormRow(label: "Title is Bold", view: .makeWrapper(for: titleIsBold))
addFormRow(label: "Eyebrow is Bold", view: .makeWrapper(for: eyebrowIsBold))
addFormRow(label: "Title is Bold", view: titleIsBold)
addFormRow(label: "Eyebrow is Bold", view: eyebrowIsBold)
addFormRow(label: "Title Style", view: titleStandardStylePickerSelectorView)
addFormRow(label: "Other Style", view: otherStandardStylePickerSelectorView)

View File

@ -0,0 +1,132 @@
//
// ToggleViewController.swift
// VDSSample
//
// Created by Matt Bruce on 8/1/22.
//
import Foundation
import UIKit
import VDS
import VDSColorTokens
class ToggleItemViewController: BaseViewController<ToggleItem> {
lazy var textSizePickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
items: ToggleItem.TextSize.allCases)
}()
lazy var textPositionPickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
items: ToggleItem.TextPosition.allCases)
}()
var disabledSwitch = Toggle()
var showTextSwitch = Toggle()
var textFormStackView = FormSection()
var boldSwitch = Toggle()
var onTextField = TextField()
var offTextField = TextField()
override func viewDidLoad() {
super.viewDidLoad()
let stack = UIStackView()
stack.axis = .vertical
stack.distribution = .fill
stack.alignment = .trailing
stack.addArrangedSubview(component)
//addContentTopView(view: component)
addContentTopView(view: .makeWrapper(for: component))
setupPicker()
}
override func allTextFields() -> [TextField]? { [onTextField, offTextField] }
override func setupForm() {
super.setupForm()
addFormRow(label: "Show Text", view: showTextSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: disabledSwitch)
//add the hidden elements to textFormStackView
textFormStackView.addFormRow(label: "Bold", view: boldSwitch)
textFormStackView.addFormRow(label: "Text Size", view: textSizePickerSelectorView)
textFormStackView.addFormRow(label: "Text Position", view: textPositionPickerSelectorView)
textFormStackView.addFormRow(label: "On Text", view: onTextField)
textFormStackView.addFormRow(label: "Off Text", view: offTextField)
//add textFormStackView to main form
append(section: textFormStackView)
component.onChange = { [weak self] toggle in
let alertController:UIAlertController = UIAlertController(title: "Alert",
message: "Toggle Value: \(toggle.isOn)",
preferredStyle: UIAlertController.Style.alert)
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler:nil))
self?.present(alertController, animated: true)
print("toggle changed: \(toggle.isOn)")
}
showTextSwitch.onChange = { [weak self] sender in
self?.component.showText = sender.isOn
self?.textFormStackView.isHidden = !sender.isOn
}
disabledSwitch.onChange = { [weak self] sender in
self?.component.disabled = sender.isOn
}
boldSwitch.onChange = { [weak self] sender in
self?.component.textWeight = sender.isOn ? .bold : .regular
}
onTextField
.textPublisher
.sink { [weak self] text in
self?.component.onText = text
}.store(in: &subscribers)
offTextField
.textPublisher
.sink { [weak self] text in
self?.component.offText = text
}.store(in: &subscribers)
textFormStackView.isHidden = true
//setup UI
surfacePickerSelectorView.text = component.surface.rawValue
textSizePickerSelectorView.text = component.textSize.rawValue
textPositionPickerSelectorView.text = component.textPosition.rawValue
onTextField.text = component.onText
offTextField.text = component.offText
}
//Picker
func setupPicker(){
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.surface = item
self?.contentTopView.backgroundColor = item.color
}
textSizePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.textSize = item
}
textPositionPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.textPosition = item
}
}
}

View File

@ -1,8 +1,8 @@
//
// ToggleViewController.swift
// ToggleElementViewController.swift
// VDSSample
//
// Created by Matt Bruce on 8/1/22.
// Created by Matt Bruce on 7/19/23.
//
import Foundation
@ -11,55 +11,31 @@ import VDS
import VDSColorTokens
class ToggleViewController: BaseViewController<Toggle> {
lazy var textSizePickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
items: Toggle.TextSize.allCases)
}()
lazy var textPositionPickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
items: Toggle.TextPosition.allCases)
}()
var disabledSwitch = Toggle()
var showTextSwitch = Toggle()
var textFormStackView = FormSection()
var boldSwitch = Toggle()
var onTextField = TextField()
var offTextField = TextField()
override func viewDidLoad() {
super.viewDidLoad()
addContentTopView(view: .makeWrapper(for: component))
// let stack = UIStackView()
// stack.axis = .vertical
// stack.spacing = 10
// stack.distribution = .fill
// stack.alignment = .trailing
// stack.addArrangedSubview(component)
// stack.addArrangedSubview(UISwitch().with { $0.isOn = true })
// addContentTopView(view: stack)
addContentTopView(view: component)
setupPicker()
}
override func allTextFields() -> [TextField]? { [onTextField, offTextField] }
override func setupForm() {
super.setupForm()
addFormRow(label: "Show Text", view: .makeWrapper(for: showTextSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
//add the hidden elements to textFormStackView
textFormStackView.addFormRow(label: "Bold", view: .makeWrapper(for: boldSwitch))
textFormStackView.addFormRow(label: "Text Size", view: textSizePickerSelectorView)
textFormStackView.addFormRow(label: "Text Position", view: textPositionPickerSelectorView)
textFormStackView.addFormRow(label: "On Text", view: onTextField)
textFormStackView.addFormRow(label: "Off Text", view: offTextField)
//add textFormStackView to main form
append(section: textFormStackView)
addFormRow(label: "Disabled", view: disabledSwitch)
component.onChange = { [weak self] toggle in
let alertController:UIAlertController = UIAlertController(title: "Alert",
message: "Toggle Value: \(toggle.isOn)",
@ -69,56 +45,20 @@ class ToggleViewController: BaseViewController<Toggle> {
print("toggle changed: \(toggle.isOn)")
}
showTextSwitch.onChange = { [weak self] sender in
self?.component.showText = sender.isOn
self?.textFormStackView.isHidden = !sender.isOn
}
disabledSwitch.onChange = { [weak self] sender in
self?.component.disabled = sender.isOn
}
boldSwitch.onChange = { [weak self] sender in
self?.component.textWeight = sender.isOn ? .bold : .regular
}
onTextField
.textPublisher
.sink { [weak self] text in
self?.component.onText = text
}.store(in: &subscribers)
offTextField
.textPublisher
.sink { [weak self] text in
self?.component.offText = text
}.store(in: &subscribers)
textFormStackView.isHidden = true
//setup UI
surfacePickerSelectorView.text = component.surface.rawValue
textSizePickerSelectorView.text = component.textSize.rawValue
textPositionPickerSelectorView.text = component.textPosition.rawValue
onTextField.text = component.onText
offTextField.text = component.offText
}
//Picker
//Picker
func setupPicker(){
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.surface = item
self?.contentTopView.backgroundColor = item.color
}
textSizePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.textSize = item
}
textPositionPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.textPosition = item
}
}
}

View File

@ -42,7 +42,7 @@ class TooltipViewController: BaseViewController<Tooltip> {
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Size", view: sizePickerSelectorView)
addFormRow(label: "FillColor", view: fillColorPickerSelectorView)

View File

@ -50,8 +50,8 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Bold", view: .makeWrapper(for: boldSwitch))
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Bold", view: boldSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Text Position", view: textPositionPickerSelectorView)
addFormRow(label: "Font Category", view: fontCategoryPickerSelectorView)