70 lines
2.7 KiB
Swift
70 lines
2.7 KiB
Swift
//
|
|
// FootnoteGroupViewController.swift
|
|
// VDSSample
|
|
//
|
|
// Created by Kanamarlapudi, Vasavi on 29/08/24.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
import VDS
|
|
|
|
class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|