diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 8f12f19..280135f 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -35,6 +35,7 @@ 180636CB2C29B12B00C92D86 /* InputStepperViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 180636CA2C29B12B00C92D86 /* InputStepperViewController.swift */; }; 1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */; }; 1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */; }; + 183B16F52C80B27C00BA6A10 /* FootnoteGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */; }; 184023492C61E9E700A412C8 /* PriceLockupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 184023482C61E9E700A412C8 /* PriceLockupViewController.swift */; }; 186D13CD2BBA990800986B53 /* DropdownSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */; }; 18926F5F2C76185A00C55BF6 /* FootnoteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */; }; @@ -136,6 +137,7 @@ 180636CA2C29B12B00C92D86 /* InputStepperViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputStepperViewController.swift; sourceTree = ""; }; 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselScrollbarViewConttroller.swift; sourceTree = ""; }; 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = ""; }; + 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteGroupViewController.swift; sourceTree = ""; }; 184023482C61E9E700A412C8 /* PriceLockupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PriceLockupViewController.swift; sourceTree = ""; }; 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownSelectViewController.swift; sourceTree = ""; }; 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FootnoteViewController.swift; sourceTree = ""; }; @@ -344,6 +346,7 @@ EA1758452BC8893700A5C0D9 /* DatePickerViewController.swift */, 186D13CC2BBA990800986B53 /* DropdownSelectViewController.swift */, 18926F5E2C76185A00C55BF6 /* FootnoteViewController.swift */, + 183B16F42C80B27C00BA6A10 /* FootnoteGroupViewController.swift */, EA985C00296CC21C00F2FF2E /* IconViewController.swift */, 180636CA2C29B12B00C92D86 /* InputStepperViewController.swift */, EAA5EEAC28EB6924003B3210 /* InputFieldViewController.swift */, @@ -562,6 +565,7 @@ 18AE87522C06FDD60075F181 /* CarouselViewController.swift in Sources */, EA596ABA2A16B2ED00300C4B /* TabsViewController.swift in Sources */, EA89204E28B67332006B9984 /* CheckBoxGroupViewController.swift in Sources */, + 183B16F52C80B27C00BA6A10 /* FootnoteGroupViewController.swift in Sources */, EAA5EEAD28EB6924003B3210 /* InputFieldViewController.swift in Sources */, 440B84CC2BD8E98B004A732A /* TableViewController.swift in Sources */, EA985C25296E06EA00F2FF2E /* TextAreaViewController.swift in Sources */, diff --git a/VDSSample/ViewControllers/FootnoteGroupViewController.swift b/VDSSample/ViewControllers/FootnoteGroupViewController.swift new file mode 100644 index 0000000..ec083f3 --- /dev/null +++ b/VDSSample/ViewControllers/FootnoteGroupViewController.swift @@ -0,0 +1,69 @@ +// +// FootnoteGroupViewController.swift +// VDSSample +// +// Created by Kanamarlapudi, Vasavi on 29/08/24. +// + +import Foundation +import UIKit +import VDS + +class FootnoteGroupViewController: BaseViewController { + + var widthTextField = NumericField() + var percentageTextField = NumericField() + var footnotes: [Footnote] = [] + + override func viewDidLoad() { + super.viewDidLoad() + addContentTopView(view: component) + setupPicker() + setupModel() + } + + override func setupForm() { + super.setupForm() + addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Width", view: widthTextField) + addFormRow(label: "Percentage (1-100)", view: percentageTextField) + + widthTextField + .numberPublisher + .sink { [weak self] number in + if let number { + self?.component.width = .value(number.cgFloatValue) + self?.percentageTextField.text = "" + } else { + self?.component.width = nil + } + }.store(in: &subscribers) + + percentageTextField + .numberPublisher + .sink { [weak self] number in + if let number, number.intValue > 9 { + self?.component.width = .percentage(number.cgFloatValue) + self?.widthTextField.text = "" + } else { + self?.component.width = nil + } + }.store(in: &subscribers) + + } + + func setupModel() { + let toolTipModel = Tooltip.TooltipModel.init(title: "Check your item.", content:"Here is the content for your item.") + footnotes.append(Footnote().with { $0.text = "Offer you best deals on phones, tablets, home, internet and more. Pre order the new version mobiles and get off *T&C apply."; $0.symbolType = .asterisk; $0.kind = .primary; $0.tooltipModel = toolTipModel}) + footnotes.append(Footnote().with { $0.text = "The display has rounded corners. When measured as a standard rectangular shape, the screen is 6.68 inches diagonally. Actual viewable area is less."; $0.symbolType = .doubleAsterisk; $0.kind = .primary}) + footnotes.append(Footnote().with { $0.text = " Some features may not be available for all countries or all areas."; $0.symbolType = .character; $0.kind = .primary}) + component.footnoteitems = footnotes + } + + func setupPicker() { + surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.component.surface = item + self?.contentTopView.backgroundColor = item.color + } + } +} diff --git a/VDSSample/ViewControllers/FootnoteViewController.swift b/VDSSample/ViewControllers/FootnoteViewController.swift index ab74405..4da0da6 100644 --- a/VDSSample/ViewControllers/FootnoteViewController.swift +++ b/VDSSample/ViewControllers/FootnoteViewController.swift @@ -68,7 +68,7 @@ class FootnoteViewController: BaseViewController { percentageTextField .numberPublisher .sink { [weak self] number in - if let number { + if let number, number.intValue > 9 { self?.component.width = .percentage(number.cgFloatValue) self?.widthTextField.text = "" } else { diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index 26ca468..1475bed 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -83,6 +83,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable { MenuComponent(title: "DatePicker", completed: true, viewController: DatePickerViewController.self), MenuComponent(title: "DropdownSelect", completed: true, viewController: DropdownSelectViewController.self), MenuComponent(title: "Footnote", completed: false, viewController: FootnoteViewController.self), + MenuComponent(title: "FootnoteGroup", completed: false, viewController: FootnoteGroupViewController.self), MenuComponent(title: "Icon", completed: true, viewController: IconViewController.self), MenuComponent(title: "InputField", completed: true, viewController: InputFieldViewController.self), MenuComponent(title: "InputStepper", completed: true, viewController: InputStepperViewController.self),