Digital ACT-191 ONEAPP-10586 story: did setup form and model to pass values to the properties
This commit is contained in:
parent
3713d200c9
commit
0f5bef548a
@ -11,6 +11,28 @@ import VDS
|
||||
|
||||
class FootnoteViewController: BaseViewController<Footnote> {
|
||||
|
||||
lazy var kindPickerSelectorView = {
|
||||
PickerSelectorView(title: "secondary",
|
||||
picker: self.picker,
|
||||
items: Footnote.Kind.allCases)
|
||||
}()
|
||||
|
||||
lazy var symbolTypePickerSelectorView = {
|
||||
PickerSelectorView(title: "asterisk",
|
||||
picker: self.picker,
|
||||
items: Footnote.SymbolType.allCases)
|
||||
}()
|
||||
|
||||
lazy var sizePickerSelectorView = {
|
||||
PickerSelectorView(title: "micro",
|
||||
picker: self.picker,
|
||||
items: Footnote.Size.allCases)
|
||||
}()
|
||||
|
||||
var hideSymbolSwitch = Toggle()
|
||||
var widthTextField = NumericField()
|
||||
var percentageTextField = NumericField()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: component)
|
||||
@ -21,10 +43,47 @@ class FootnoteViewController: BaseViewController<Footnote> {
|
||||
override func setupForm() {
|
||||
super.setupForm()
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
addFormRow(label: "Kind", view: kindPickerSelectorView)
|
||||
addFormRow(label: "Size", view: sizePickerSelectorView)
|
||||
addFormRow(label: "Symbol Type", view: symbolTypePickerSelectorView)
|
||||
addFormRow(label: "Hide Symbol", view: hideSymbolSwitch)
|
||||
addFormRow(label: "Width", view: widthTextField)
|
||||
addFormRow(label: "Percentage (1-100)", view: percentageTextField)
|
||||
|
||||
hideSymbolSwitch.publisher(for: .valueChanged).sink { [weak self] control in
|
||||
self?.component.hideSymbol = control.isOn
|
||||
}.store(in: &subscribers)
|
||||
|
||||
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 {
|
||||
self?.component.width = .percentage(number.cgFloatValue)
|
||||
self?.widthTextField.text = ""
|
||||
} else {
|
||||
self?.component.width = nil
|
||||
}
|
||||
}.store(in: &subscribers)
|
||||
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
component.text = "Service is included for free for two years with activation of any iPhone15 model. Connection and response times vary based on location, site conditions, and other factors. See support.apple.com/en-us/HT213885 for more information."
|
||||
|
||||
sizePickerSelectorView.text = component.size.rawValue
|
||||
kindPickerSelectorView.text = component.kind.rawValue
|
||||
symbolTypePickerSelectorView.text = component.symbolType.rawValue
|
||||
}
|
||||
|
||||
func setupPicker() {
|
||||
@ -32,5 +91,17 @@ class FootnoteViewController: BaseViewController<Footnote> {
|
||||
self?.component.surface = item
|
||||
self?.contentTopView.backgroundColor = item.color
|
||||
}
|
||||
|
||||
kindPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.kind = item
|
||||
}
|
||||
|
||||
sizePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.size = item
|
||||
}
|
||||
|
||||
symbolTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.symbolType = item
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user