added checkbox group

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-08-23 10:30:08 -05:00
parent 022a2271d7
commit 94b2c9e533
4 changed files with 317 additions and 10 deletions

View File

@ -40,6 +40,7 @@
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 */; };
EA89200A28B52934006B9984 /* CheckboxGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89200928B52934006B9984 /* CheckboxGroupViewController.swift */; };
EAB1D2C528A6B11D00DAE764 /* TestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2C428A6B11D00DAE764 /* TestViewController.swift */; };
EAB1D2C928AAAA1D00DAE764 /* ModelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2C828AAAA1D00DAE764 /* ModelViewController.swift */; };
EAB1D2CB28AAB9E200DAE764 /* TemplateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2CA28AAB9E200DAE764 /* TemplateViewController.swift */; };
@ -93,6 +94,7 @@
EA3C3BBA289968A0000CA526 /* VDSTypographyTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSTypographyTokens.xcframework; path = ../SharedFrameworks/VDSTypographyTokens.xcframework; sourceTree = "<group>"; };
EA3C3BBB289968A0000CA526 /* VDSFormControlsTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSFormControlsTokens.xcframework; path = ../SharedFrameworks/VDSFormControlsTokens.xcframework; sourceTree = "<group>"; };
EA3C3BC3289968B1000CA526 /* VDS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = VDS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
EA89200928B52934006B9984 /* CheckboxGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckboxGroupViewController.swift; sourceTree = "<group>"; };
EAB1D2C428A6B11D00DAE764 /* TestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestViewController.swift; sourceTree = "<group>"; };
EAB1D2C828AAAA1D00DAE764 /* ModelViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelViewController.swift; sourceTree = "<group>"; };
EAB1D2CA28AAB9E200DAE764 /* TemplateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateViewController.swift; sourceTree = "<group>"; };
@ -204,6 +206,7 @@
isa = PBXGroup;
children = (
EAF7F09B2899B92400B287F5 /* CheckboxViewController.swift */,
EA89200928B52934006B9984 /* CheckboxGroupViewController.swift */,
EA3C3BB228996775000CA526 /* MenuViewController.swift */,
EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */,
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
@ -365,6 +368,7 @@
EA3C3BB428996775000CA526 /* PickerBase.swift in Sources */,
EAB1D2C528A6B11D00DAE764 /* TestViewController.swift in Sources */,
EAB1D2C928AAAA1D00DAE764 /* ModelViewController.swift in Sources */,
EA89200A28B52934006B9984 /* CheckboxGroupViewController.swift in Sources */,
EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */,
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */,
);

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21179.7" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21223" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21169.4"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21204"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@ -18,14 +18,14 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="Z57-In-p76">
<rect key="frame" x="16" y="60" width="382" height="786"/>
<rect key="frame" x="16" y="64" width="382" height="782"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PZB-Az-TdC" userLabel="Top">
<rect key="frame" x="0.0" y="0.0" width="382" height="100"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bc6-dA-dyv" userLabel="Bottom">
<rect key="frame" x="0.0" y="115" width="382" height="671"/>
<rect key="frame" x="0.0" y="115" width="382" height="667"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="c3f-mr-N3r">
<rect key="frame" x="16" y="20" width="350" height="351"/>
@ -273,14 +273,14 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="hpQ-m4-0mG">
<rect key="frame" x="16" y="60" width="382" height="786"/>
<rect key="frame" x="16" y="64" width="382" height="782"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="scQ-pX-VeB" userLabel="Top">
<rect key="frame" x="0.0" y="0.0" width="382" height="100"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XSu-xa-jsA" userLabel="Bottom">
<rect key="frame" x="0.0" y="115" width="382" height="671"/>
<rect key="frame" x="0.0" y="115" width="382" height="667"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="MRW-0g-0NJ">
<rect key="frame" x="16" y="20" width="350" height="254"/>
@ -461,14 +461,14 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="heD-pc-AZz">
<rect key="frame" x="16" y="60" width="382" height="786"/>
<rect key="frame" x="16" y="64" width="382" height="782"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jWf-eh-zqg" userLabel="Top">
<rect key="frame" x="0.0" y="0.0" width="382" height="100"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oFp-K6-Ybr" userLabel="Bottom">
<rect key="frame" x="0.0" y="115" width="382" height="671"/>
<rect key="frame" x="0.0" y="115" width="382" height="667"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="Hmj-Yn-sy0">
<rect key="frame" x="16" y="20" width="350" height="210"/>
@ -629,14 +629,14 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="Nb4-Pl-Uaf">
<rect key="frame" x="16" y="55" width="382" height="786"/>
<rect key="frame" x="16" y="59" width="382" height="782"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2AQ-Xy-Qoc" userLabel="Top">
<rect key="frame" x="0.0" y="0.0" width="382" height="100"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xlq-T6-ZY7" userLabel="Bottom">
<rect key="frame" x="0.0" y="115" width="382" height="671"/>
<rect key="frame" x="0.0" y="115" width="382" height="667"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="KWq-vB-Ueq">
<rect key="frame" x="16" y="20" width="350" height="266"/>
@ -836,6 +836,174 @@
</objects>
<point key="canvasLocation" x="-2158" y="-313"/>
</scene>
<!--Checkbox Group View Controller-->
<scene sceneID="ZRn-ge-A3w">
<objects>
<viewController storyboardIdentifier="checkboxGroup" id="3hk-1a-je8" customClass="CheckboxGroupViewController" customModule="VDSSample" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="a7F-u0-Jqh">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="Y3m-jb-zzr">
<rect key="frame" x="16" y="64" width="382" height="782"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8cR-rm-Ruj" userLabel="Top">
<rect key="frame" x="0.0" y="0.0" width="382" height="100"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5Ip-CE-x4s" userLabel="Bottom">
<rect key="frame" x="0.0" y="115" width="382" height="667"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="snM-KR-2Aq">
<rect key="frame" x="16" y="20" width="350" height="210"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="41D-7E-9oI">
<rect key="frame" x="0.0" y="0.0" width="350" height="31"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Disabled" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FGz-Zo-YnX">
<rect key="frame" x="0.0" y="0.0" width="175" height="31"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="BXT-Pv-JaZ">
<rect key="frame" x="175" y="0.0" width="177" height="31"/>
<connections>
<action selector="disabledChanged:" destination="3hk-1a-je8" eventType="touchUpInside" id="feV-JO-Vdz"/>
</connections>
</switch>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="25Z-cE-hpA">
<rect key="frame" x="0.0" y="41" width="350" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Surface" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="E3I-pY-mlh">
<rect key="frame" x="0.0" y="0.0" width="175" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="PUy-cm-8RI">
<rect key="frame" x="175" y="0.0" width="175" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="light" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b3L-Ay-8MI">
<rect key="frame" x="0.0" y="0.0" width="87.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3De-kE-ANz">
<rect key="frame" x="87.5" y="0.0" width="87.5" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="mVv-RG-GnP"/>
</constraints>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="Select"/>
<connections>
<action selector="surfaceClick:" destination="3hk-1a-je8" eventType="touchUpInside" id="xXG-sM-Bg5"/>
</connections>
</button>
</subviews>
</stackView>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="qe3-iw-bDE">
<rect key="frame" x="0.0" y="91" width="350" height="34"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label Text" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fNO-uE-V6P">
<rect key="frame" x="0.0" y="0.0" width="175" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="tDk-8h-7P9">
<rect key="frame" x="175" y="0.0" width="175" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="onLabelTextDidEnd:" destination="3hk-1a-je8" eventType="editingDidEnd" id="l5q-m2-74N"/>
</connections>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="fj4-XE-Fim">
<rect key="frame" x="0.0" y="135" width="350" height="34"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Child Text" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bWI-Zh-dAz">
<rect key="frame" x="0.0" y="0.0" width="175" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mlX-WT-q3b">
<rect key="frame" x="175" y="0.0" width="175" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="onChildTextDidEnd:" destination="3hk-1a-je8" eventType="editingDidEnd" id="TJ0-Tv-KQp"/>
</connections>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="iLx-aU-Vvg">
<rect key="frame" x="0.0" y="179" width="350" height="31"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Error" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HTA-Do-zA7">
<rect key="frame" x="0.0" y="0.0" width="175" height="31"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="2S4-0S-QCG">
<rect key="frame" x="175" y="0.0" width="177" height="31"/>
<connections>
<action selector="showErrorChanged:" destination="3hk-1a-je8" eventType="touchUpInside" id="fpm-ow-ISh"/>
</connections>
</switch>
</subviews>
</stackView>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="snM-KR-2Aq" secondAttribute="trailing" constant="16" id="8N4-lT-8kb"/>
<constraint firstItem="snM-KR-2Aq" firstAttribute="top" secondItem="5Ip-CE-x4s" secondAttribute="top" constant="20" id="JZR-Yo-8gS"/>
<constraint firstItem="snM-KR-2Aq" firstAttribute="leading" secondItem="5Ip-CE-x4s" secondAttribute="leading" constant="16" id="dWb-Lw-COT"/>
</constraints>
</view>
</subviews>
</stackView>
<pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="C6E-GY-8Mb">
<rect key="frame" x="0.0" y="646" width="414" height="216"/>
</pickerView>
</subviews>
<viewLayoutGuide key="safeArea" id="AMI-EY-Vw1"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="AMI-EY-Vw1" firstAttribute="trailing" secondItem="Y3m-jb-zzr" secondAttribute="trailing" constant="16" id="0NW-0Q-ovy"/>
<constraint firstItem="Y3m-jb-zzr" firstAttribute="top" secondItem="AMI-EY-Vw1" secondAttribute="top" constant="16" id="1o7-lN-8Zx"/>
<constraint firstItem="AMI-EY-Vw1" firstAttribute="bottom" secondItem="C6E-GY-8Mb" secondAttribute="bottom" id="6he-dL-HCb"/>
<constraint firstItem="Y3m-jb-zzr" firstAttribute="leading" secondItem="AMI-EY-Vw1" secondAttribute="leading" constant="16" id="C2r-dh-WbN"/>
<constraint firstItem="AMI-EY-Vw1" firstAttribute="bottom" secondItem="Y3m-jb-zzr" secondAttribute="bottom" constant="16" id="ENT-ms-gyN"/>
<constraint firstItem="C6E-GY-8Mb" firstAttribute="leading" secondItem="AMI-EY-Vw1" secondAttribute="leading" id="Lhe-Ja-fdt"/>
<constraint firstItem="C6E-GY-8Mb" firstAttribute="trailing" secondItem="AMI-EY-Vw1" secondAttribute="trailing" id="syN-a4-EDE"/>
</constraints>
</view>
<connections>
<outlet property="checkboxContainerView" destination="8cR-rm-Ruj" id="BVs-kT-Fss"/>
<outlet property="childTextField" destination="mlX-WT-q3b" id="ghO-mE-THF"/>
<outlet property="disabledSwitch" destination="BXT-Pv-JaZ" id="jBQ-BA-eaN"/>
<outlet property="labelTextField" destination="tDk-8h-7P9" id="mLQ-ML-13h"/>
<outlet property="picker" destination="C6E-GY-8Mb" id="Clj-kE-hWC"/>
<outlet property="showErrorSwitch" destination="2S4-0S-QCG" id="WPs-vc-UHg"/>
<outlet property="surfaceLabel" destination="b3L-Ay-8MI" id="MJu-Bd-rSP"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="fZh-fi-Xqq" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-3946" y="376"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">

View File

@ -0,0 +1,134 @@
//
// CheckboxViewController.swift
// VDSSample
//
// Created by Matt Bruce on 8/1/22.
//
import Foundation
import UIKit
import VDS
import VDSColorTokens
import Combine
class CheckboxGroupViewController: ModelViewController<DefaultCheckboxGroupModel>, StoryboardInitable {
enum PickerType {
case surface
}
static var storyboardId: String = "checkboxGroup"
static var storyboardName: String = "Components"
@IBOutlet weak var checkboxContainerView: 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!
var checkboxGroup = CheckboxGroup()
override func viewDidLoad() {
super.viewDidLoad()
checkboxContainerView.addSubview(checkboxGroup)
checkboxGroup.leadingAnchor.constraint(equalTo: checkboxContainerView.leadingAnchor, constant: 10).isActive = true
checkboxGroup.bottomAnchor.constraint(equalTo: checkboxContainerView.bottomAnchor, constant: -20).isActive = true
checkboxGroup.topAnchor.constraint(equalTo: checkboxContainerView.topAnchor, constant: 20).isActive = true
checkboxGroup.trailingAnchor.constraint(equalTo: checkboxContainerView.trailingAnchor, constant: 10).isActive = true
view.addGestureRecognizer(UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing(_:))))
setupPicker()
setupModel()
}
func setupModel() {
var defaultModel = DefaultCheckboxGroupModel()
var model1 = DefaultCheckboxModel()
model1.value = "model 1 Value"
model1.labelText = "iPhone 11 Bundle 1"
model1.childText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
var model2 = DefaultCheckboxModel()
model2.value = "model 2 Value"
model2.labelText = "iPhone 11 Bundle 2"
model2.childText = "Apple iPhone 11 - 128 GB\nOtterbox Case Black\nScreen Protector"
defaultModel.selectors = [model1, model2]
set(with: defaultModel)
checkboxGroup
.handlerPublisher()
.sink { [weak self] viewModel in
self?.model = viewModel
}.store(in: &subscribers)
//setup UI
surfaceLabel.text = model.surface.rawValue
disabledSwitch.isOn = model.disabled
labelTextField.text = model2.labelText
childTextField.text = model1.childText
showErrorSwitch.isOn = model.hasError
}
override func updateView(viewModel: DefaultCheckboxGroupModel) {
print("\(Self.self) updateView(viewModel)")
checkboxGroup.set(with: viewModel)
}
var checkbox: Checkbox? {
checkboxGroup.selectorViews.first
}
@IBAction func disabledChanged(_ sender: UISwitch) {
checkboxGroup.disabled = sender.isOn
}
@IBAction func onLabelTextDidEnd(_ sender: UITextField) {
checkbox?.labelText = sender.text
sender.resignFirstResponder()
}
@IBAction func onChildTextDidEnd(_ sender: UITextField) {
checkbox?.childText = sender.text
sender.resignFirstResponder()
}
@IBAction func showErrorChanged(_ sender: UISwitch) {
checkboxGroup.hasError = sender.isOn
}
@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 = { [weak self] item in
self?.checkboxGroup.surface = item
self?.checkboxContainerView.backgroundColor = item.color
self?.surfaceLabel.text = item.rawValue
}
}
}

View File

@ -22,6 +22,7 @@ class MenuViewController: UITableViewController {
MenuComponent(title: "Label", viewController: LabelViewController.self),
MenuComponent(title: "Toggle", viewController: ToggleViewController.self),
MenuComponent(title: "Checkbox", viewController: CheckboxViewController.self),
MenuComponent(title: "CheckboxGroup", viewController: CheckboxGroupViewController.self),
MenuComponent(title: "RadioButton", viewController: RadioButtonViewController.self),
MenuComponent(title: "Test Form", viewController: TestViewController.self),
MenuComponent(title: "Template", viewController: TemplateViewController.self)