diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index fc9f459..f43ffeb 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -35,6 +35,7 @@ 1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */; }; 1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */; }; 186D13CD2BBA990800986B53 /* DropdownSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */; }; + 440B84CC2BD8E98B004A732A /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440B84CB2BD8E98B004A732A /* TableViewController.swift */; }; 445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07929C088470036A7C5 /* NotificationViewController.swift */; }; 44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD829CE1CF900E62B51 /* LineViewController.swift */; }; 5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; }; @@ -129,6 +130,7 @@ 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselScrollbarViewConttroller.swift; sourceTree = ""; }; 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = ""; }; 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownSelectViewController.swift; sourceTree = ""; }; + 440B84CB2BD8E98B004A732A /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; 445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = ""; }; 44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = ""; }; 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = ""; }; @@ -333,6 +335,7 @@ EAF7F11928A14A0E00B287F5 /* RadioButtonGroupViewController.swift */, EA0D1C322A673FD400E5C127 /* RadioButtonItemViewController.swift */, EA0D1C302A673F3500E5C127 /* RadioButtonViewController.swift */, + 440B84CB2BD8E98B004A732A /* TableViewController.swift */, EA5F86CD2A1E863F00BC83E4 /* TabsContainerViewController.swift */, EA596AB92A16B2ED00300C4B /* TabsViewController.swift */, EA985C24296E06EA00F2FF2E /* TextAreaViewController.swift */, @@ -532,6 +535,7 @@ EA596ABA2A16B2ED00300C4B /* TabsViewController.swift in Sources */, EA89204E28B67332006B9984 /* CheckBoxGroupViewController.swift in Sources */, EAA5EEAD28EB6924003B3210 /* InputFieldViewController.swift in Sources */, + 440B84CC2BD8E98B004A732A /* TableViewController.swift in Sources */, EA985C25296E06EA00F2FF2E /* TextAreaViewController.swift in Sources */, 1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */, EA81410E2A0ED8DC004F60D2 /* ButtonIconViewController.swift in Sources */, diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index c300171..fd1f3eb 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -91,6 +91,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable { MenuComponent(title: "RadioButtonItem", completed: true, viewController: RadioButtonItemViewController.self), MenuComponent(title: "RadioButtonGroup", completed: true, viewController: RadioButtonGroupViewController.self), // //MenuComponent(title: "TabsContainer", completed: false, viewController: TabsContainerViewController.self), + MenuComponent(title: "Table", completed: false, viewController: TableViewController.self), MenuComponent(title: "Tabs", completed: true, viewController: TabsViewController.self), MenuComponent(title: "TextArea", completed: true, viewController: TextAreaViewController.self), MenuComponent(title: "TextLink", completed: true, viewController: TextLinkViewController.self), diff --git a/VDSSample/ViewControllers/TableViewController.swift b/VDSSample/ViewControllers/TableViewController.swift new file mode 100644 index 0000000..6f00b67 --- /dev/null +++ b/VDSSample/ViewControllers/TableViewController.swift @@ -0,0 +1,81 @@ +// +// TableViewController.swift +// VDSSample +// +// Created by Nadigadda, Sumanth on 24/04/24. +// + +import Foundation +import VDS + +class TableViewController: BaseViewController { + + var showHeaderLine = Toggle() + var showRowLine = Toggle() + var striped = Toggle() + + lazy var headerLineStylePicker = { + PickerSelectorView(title: "Style", picker: self.picker, items: Line.Style.allCases) + }() + + lazy var rowLineStylePicker = { + PickerSelectorView(title: "Style", picker: self.picker, items: Line.Style.allCases) + }() + + lazy var paddingPicker = { + PickerSelectorView(title: "Padding", picker: self.picker, items: Table.Padding.allCases) + }() + + override func viewDidLoad() { + super.viewDidLoad() + self.setupPicker() + self.setupModel() + } + + override func setupForm() { + addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Padding", view: paddingPicker) + addFormRow(label: "Header line style", view: headerLineStylePicker) + addFormRow(label: "Row line style", view: rowLineStylePicker) + addFormRow(label: "Show header line", view: showHeaderLine) + addFormRow(label: "Show row line", view: showRowLine) + addFormRow(label: "Striped", view: striped) + + addContentTopView(view: component) + + showHeaderLine.onChange = { [weak self] sender in + self?.component.headerBottomLine = sender.isOn + } + + showRowLine.onChange = { [weak self] sender in + self?.component.rowBottomLine = sender.isOn + } + + striped.onChange = { [weak self] sender in + self?.component.striped = sender.isOn + } + } + + func setupPicker() { + surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.component.surface = item + self?.contentTopView.backgroundColor = item.color + } + + headerLineStylePicker.onPickerDidSelect = { [weak self] item in + self?.component.headerBottomLineType = item + } + + rowLineStylePicker.onPickerDidSelect = { [weak self] item in + self?.component.rowBottomLineType = item + } + + paddingPicker.onPickerDidSelect = { [weak self] item in + self?.component.padding = item + } + } + + func setupModel() { + self.component.tableData = [["", "Verizon smart family", "Call filter"], ["Cost", "$5/month for up to 10 lines", "$2.99/month per device"], ["Block calls and messages from specific numbers\nBlock calls and messages from specific numbers", "Permanently", "Permanently"], ["Block web domains", "Patrick", "Jane"], ["Block calls and messages from specific numbers", "Permanently","Permanently"]] + } +}