added textLink
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
0c0fb2ef44
commit
956db9f663
@ -55,6 +55,7 @@
|
||||
EA89205128B68307006B9984 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89205028B68307006B9984 /* TextField.swift */; };
|
||||
EAB1D2C928AAAA1D00DAE764 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2C828AAAA1D00DAE764 /* BaseViewController.swift */; };
|
||||
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */; };
|
||||
EAC9258029119FC400091998 /* TextLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAC9257F29119FC400091998 /* TextLink.swift */; };
|
||||
EAF7F07D2899698800B287F5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F07B2899698800B287F5 /* Assets.xcassets */; };
|
||||
EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F09B2899B92400B287F5 /* CheckboxViewController.swift */; };
|
||||
EAF7F0CA289DA24F00B287F5 /* ArtifactoryItems.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F0C5289DA24F00B287F5 /* ArtifactoryItems.txt */; };
|
||||
@ -118,6 +119,7 @@
|
||||
EA89205028B68307006B9984 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = "<group>"; };
|
||||
EAB1D2C828AAAA1D00DAE764 /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = "<group>"; };
|
||||
EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelViewController.swift; sourceTree = "<group>"; };
|
||||
EAC9257F29119FC400091998 /* TextLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLink.swift; sourceTree = "<group>"; };
|
||||
EAF7F07B2899698800B287F5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
EAF7F09B2899B92400B287F5 /* CheckboxViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckboxViewController.swift; sourceTree = "<group>"; };
|
||||
EAF7F0C5289DA24F00B287F5 /* ArtifactoryItems.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ArtifactoryItems.txt; sourceTree = "<group>"; };
|
||||
@ -256,6 +258,7 @@
|
||||
EA89201828B56DF5006B9984 /* RadioBoxGroupViewController.swift */,
|
||||
EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */,
|
||||
EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */,
|
||||
EAC9257F29119FC400091998 /* TextLink.swift */,
|
||||
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
||||
);
|
||||
path = ViewControllers;
|
||||
@ -420,6 +423,7 @@
|
||||
EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */,
|
||||
EA89204E28B67332006B9984 /* CheckBoxGroupViewController.swift in Sources */,
|
||||
EA89204928B66CE2006B9984 /* KeyboardFrameChangeListening.swift in Sources */,
|
||||
EAC9258029119FC400091998 /* TextLink.swift in Sources */,
|
||||
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */,
|
||||
EA89204B28B66CE2006B9984 /* ScrollViewKeyboardAvoider.swift in Sources */,
|
||||
EA84F76228BE4AE500D67ABC /* RadioSwatchGroupViewController.swift in Sources */,
|
||||
|
||||
@ -28,6 +28,7 @@ class MenuViewController: UITableViewController {
|
||||
MenuComponent(title: "RadioBoxGroup", viewController: RadioBoxGroupViewController.self),
|
||||
MenuComponent(title: "RadioSwatchGroup", viewController: RadioSwatchGroupViewController.self),
|
||||
//MenuComponent(title: "TextEntryField", viewController: TextEntryFieldViewController.self),
|
||||
MenuComponent(title: "TextLink", viewController: TextLinkViewController.self),
|
||||
MenuComponent(title: "Toggle", viewController: ToggleViewController.self)
|
||||
]
|
||||
|
||||
|
||||
87
VDSSample/ViewControllers/TextLink.swift
Normal file
87
VDSSample/ViewControllers/TextLink.swift
Normal file
@ -0,0 +1,87 @@
|
||||
//
|
||||
// TextLink.swift
|
||||
// VDSSample
|
||||
//
|
||||
// Created by Matt Bruce on 11/1/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import VDS
|
||||
import VDSColorTokens
|
||||
|
||||
class TextLinkViewController: BaseViewController {
|
||||
|
||||
lazy var buttonSizePickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: ButtonSize.allCases)
|
||||
}()
|
||||
|
||||
var disabledSwitch = UISwitch()
|
||||
var textField = TextField()
|
||||
let textLink = TextLink()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
let view = UIView()
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(textLink)
|
||||
textLink.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
|
||||
textLink.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
|
||||
textLink.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
|
||||
addContentTopView(view: view)
|
||||
|
||||
setupForm()
|
||||
setupPicker()
|
||||
setupModel()
|
||||
}
|
||||
|
||||
func setupForm(){
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
addFormRow(label: "Disabled", view: disabledSwitch)
|
||||
addFormRow(label: "Label", view: textField)
|
||||
addFormRow(label: "Size", view: buttonSizePickerSelectorView)
|
||||
|
||||
disabledSwitch
|
||||
.publisher(for: .valueChanged)
|
||||
.sink { [weak self] sender in
|
||||
self?.textLink.disabled = sender.isOn
|
||||
}.store(in: &subscribers)
|
||||
|
||||
textField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.textLink.text = text
|
||||
}.store(in: &subscribers)
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
textLink.text = "Text Link"
|
||||
|
||||
textLink
|
||||
.publisher(for: .touchUpInside)
|
||||
.sink { control in
|
||||
print("clicked me")
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
//setup UI
|
||||
surfacePickerSelectorView.text = textLink.surface.rawValue
|
||||
disabledSwitch.isOn = textLink.disabled
|
||||
textField.text = textLink.text
|
||||
buttonSizePickerSelectorView.text = ButtonSize.large.rawValue
|
||||
}
|
||||
|
||||
func setupPicker(){
|
||||
|
||||
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.textLink.surface = item
|
||||
self?.contentTopView.backgroundColor = item.color
|
||||
}
|
||||
|
||||
buttonSizePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.textLink.size = item
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,7 @@ class ToggleViewController: BaseViewController {
|
||||
}()
|
||||
|
||||
var disabledSwitch = UISwitch()
|
||||
var showTextSwitch = UISwitch()
|
||||
var showTextSwitch = Toggle()
|
||||
|
||||
var textFormStackView: UIStackView = {
|
||||
return UIStackView().with {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user