added tilet viewcontroller
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
0a86a121ad
commit
74b1ddec62
@ -45,6 +45,7 @@
|
||||
EA4DB30428DCD25B00103EE3 /* BadgeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA4DB30328DCD25B00103EE3 /* BadgeViewController.swift */; };
|
||||
EA5E3050294D11540082B959 /* TileContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5E304F294D11540082B959 /* TileContainerViewController.swift */; };
|
||||
EA5E30552950EA6E0082B959 /* TitleLockupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */; };
|
||||
EA5E305C295111050082B959 /* TiletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5E305B295111050082B959 /* TiletViewController.swift */; };
|
||||
EA84F76228BE4AE500D67ABC /* RadioSwatchGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */; };
|
||||
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89201828B56DF5006B9984 /* RadioBoxGroupViewController.swift */; };
|
||||
EA89204628B66CE2006B9984 /* ScrollViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89203F28B66CE2006B9984 /* ScrollViewController.swift */; };
|
||||
@ -111,6 +112,7 @@
|
||||
EA4DB30328DCD25B00103EE3 /* BadgeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeViewController.swift; sourceTree = "<group>"; };
|
||||
EA5E304F294D11540082B959 /* TileContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TileContainerViewController.swift; sourceTree = "<group>"; };
|
||||
EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleLockupViewController.swift; sourceTree = "<group>"; };
|
||||
EA5E305B295111050082B959 /* TiletViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TiletViewController.swift; sourceTree = "<group>"; };
|
||||
EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchGroupViewController.swift; sourceTree = "<group>"; };
|
||||
EA89201828B56DF5006B9984 /* RadioBoxGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioBoxGroupViewController.swift; sourceTree = "<group>"; };
|
||||
EA89203F28B66CE2006B9984 /* ScrollViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScrollViewController.swift; sourceTree = "<group>"; };
|
||||
@ -258,6 +260,7 @@
|
||||
EAC9257F29119FC400091998 /* TextLinkViewController.swift */,
|
||||
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */,
|
||||
EA5E304F294D11540082B959 /* TileContainerViewController.swift */,
|
||||
EA5E305B295111050082B959 /* TiletViewController.swift */,
|
||||
EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */,
|
||||
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
||||
);
|
||||
@ -420,6 +423,7 @@
|
||||
EA89204A28B66CE2006B9984 /* KeyboardFrameChange.swift in Sources */,
|
||||
EA3C3BB428996775000CA526 /* PickerBase.swift in Sources */,
|
||||
EAB1D2C928AAAA1D00DAE764 /* BaseViewController.swift in Sources */,
|
||||
EA5E305C295111050082B959 /* TiletViewController.swift in Sources */,
|
||||
EAB5FEF32928153D00998C17 /* Helper.swift in Sources */,
|
||||
EA89204728B66CE2006B9984 /* KeyboardFrameChangeListener.swift in Sources */,
|
||||
EA4DB30428DCD25B00103EE3 /* BadgeViewController.swift in Sources */,
|
||||
|
||||
117
VDSSample/ViewControllers/TiletViewController.swift
Normal file
117
VDSSample/ViewControllers/TiletViewController.swift
Normal file
@ -0,0 +1,117 @@
|
||||
//
|
||||
// TiletViewController.swift
|
||||
// VDSSample
|
||||
//
|
||||
// Created by Matt Bruce on 12/19/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import VDS
|
||||
import VDSColorTokens
|
||||
|
||||
class TiletViewController: BaseViewController {
|
||||
|
||||
lazy var titleTextStylePickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: TiletTitleTypographicalStyle.allCases.sorted{ $0.rawValue < $1.rawValue })
|
||||
}()
|
||||
|
||||
lazy var otherTextStylePickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: TiletOtherTypographicalStyle.allCases.sorted{ $0.rawValue < $1.rawValue })
|
||||
}()
|
||||
|
||||
lazy var subtitleColorPickerSelectorView = {
|
||||
PickerSelectorView<Use>(title: "",
|
||||
picker: self.picker,
|
||||
items: [.primary, .secondary])
|
||||
}()
|
||||
|
||||
var titleTextField = TextField()
|
||||
var subTitleTextField = TextField()
|
||||
var widthTextField = TextField()
|
||||
|
||||
var tilet = Tilet()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: .makeWrapper(for: tilet))
|
||||
|
||||
setupForm()
|
||||
setupPicker()
|
||||
setupModel()
|
||||
}
|
||||
|
||||
override func allTextFields() -> [UITextField]? { [titleTextField, subTitleTextField] }
|
||||
|
||||
func setupForm(){
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
|
||||
addFormRow(label: "Title Style", view: titleTextStylePickerSelectorView)
|
||||
addFormRow(label: "Other Style", view: otherTextStylePickerSelectorView)
|
||||
|
||||
addFormRow(label: "Title Text", view: titleTextField)
|
||||
addFormRow(label: "Subtitle Color", view: subtitleColorPickerSelectorView)
|
||||
addFormRow(label: "Subtitle Text", view: subTitleTextField)
|
||||
addFormRow(label: "Width", view: widthTextField)
|
||||
|
||||
widthTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
if let n = NumberFormatter().number(from: text) {
|
||||
self?.tilet.width = CGFloat(truncating: n)
|
||||
}
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
titleTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.tilet.titleText = text
|
||||
}.store(in: &subscribers)
|
||||
|
||||
subTitleTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.tilet.subTitleText = text
|
||||
}.store(in: &subscribers)
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
tilet.width = 250
|
||||
tilet.titleText = "Get more of our best"
|
||||
tilet.subTitleText = "Get both of our best and pay less. Pair 5G Home Internet with Verizon mobile to save every month."
|
||||
|
||||
//setup UI
|
||||
surfacePickerSelectorView.text = tilet.surface.rawValue
|
||||
otherTextStylePickerSelectorView.text = tilet.otherTypograpicalStyle.rawValue
|
||||
titleTextStylePickerSelectorView.text = tilet.titleTypograpicalStyle.rawValue
|
||||
subtitleColorPickerSelectorView.text = tilet.subTitleColor.rawValue
|
||||
titleTextField.text = tilet.titleText
|
||||
subTitleTextField.text = tilet.subTitleText
|
||||
widthTextField.text = "\(tilet.width)"
|
||||
}
|
||||
|
||||
//Picker
|
||||
func setupPicker(){
|
||||
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.tilet.surface = item
|
||||
self?.contentTopView.backgroundColor = item.color
|
||||
}
|
||||
|
||||
titleTextStylePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.tilet.titleTypograpicalStyle = item
|
||||
}
|
||||
|
||||
otherTextStylePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.tilet.otherTypograpicalStyle = item
|
||||
}
|
||||
|
||||
subtitleColorPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.tilet.subTitleColor = item
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user