added textlinkcaret
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
a4c723fa1e
commit
dea0a1e6ea
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
|
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
|
||||||
|
EA0FC2C12912DC5500DF80B4 /* TextLinkCaretViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */; };
|
||||||
EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9C289966EF000CA526 /* AppDelegate.swift */; };
|
EA3C3B9D289966EF000CA526 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9C289966EF000CA526 /* AppDelegate.swift */; };
|
||||||
EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */; };
|
EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */; };
|
||||||
EA3C3BA4289966EF000CA526 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA3C3BA2289966EF000CA526 /* Main.storyboard */; };
|
EA3C3BA4289966EF000CA526 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA3C3BA2289966EF000CA526 /* Main.storyboard */; };
|
||||||
@ -56,7 +57,7 @@
|
|||||||
EAA5EEAD28EB6924003B3210 /* TextEntryFieldViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEAC28EB6924003B3210 /* TextEntryFieldViewController.swift */; };
|
EAA5EEAD28EB6924003B3210 /* TextEntryFieldViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEAC28EB6924003B3210 /* TextEntryFieldViewController.swift */; };
|
||||||
EAB1D2C928AAAA1D00DAE764 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2C828AAAA1D00DAE764 /* BaseViewController.swift */; };
|
EAB1D2C928AAAA1D00DAE764 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2C828AAAA1D00DAE764 /* BaseViewController.swift */; };
|
||||||
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */; };
|
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */; };
|
||||||
EAC9258029119FC400091998 /* TextLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAC9257F29119FC400091998 /* TextLink.swift */; };
|
EAC9258029119FC400091998 /* TextLinkViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAC9257F29119FC400091998 /* TextLinkViewController.swift */; };
|
||||||
EAF7F07D2899698800B287F5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F07B2899698800B287F5 /* Assets.xcassets */; };
|
EAF7F07D2899698800B287F5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F07B2899698800B287F5 /* Assets.xcassets */; };
|
||||||
EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F09B2899B92400B287F5 /* CheckboxViewController.swift */; };
|
EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F09B2899B92400B287F5 /* CheckboxViewController.swift */; };
|
||||||
EAF7F0CA289DA24F00B287F5 /* ArtifactoryItems.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F0C5289DA24F00B287F5 /* ArtifactoryItems.txt */; };
|
EAF7F0CA289DA24F00B287F5 /* ArtifactoryItems.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F0C5289DA24F00B287F5 /* ArtifactoryItems.txt */; };
|
||||||
@ -92,6 +93,7 @@
|
|||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
|
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
|
||||||
|
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLinkCaretViewController.swift; sourceTree = "<group>"; };
|
||||||
EA3C3B99289966EF000CA526 /* VDSSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VDSSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
EA3C3B99289966EF000CA526 /* VDSSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VDSSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
EA3C3B9C289966EF000CA526 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
EA3C3B9C289966EF000CA526 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
||||||
@ -121,7 +123,7 @@
|
|||||||
EAA5EEAC28EB6924003B3210 /* TextEntryFieldViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryFieldViewController.swift; sourceTree = "<group>"; };
|
EAA5EEAC28EB6924003B3210 /* TextEntryFieldViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryFieldViewController.swift; sourceTree = "<group>"; };
|
||||||
EAB1D2C828AAAA1D00DAE764 /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.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>"; };
|
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>"; };
|
EAC9257F29119FC400091998 /* TextLinkViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLinkViewController.swift; sourceTree = "<group>"; };
|
||||||
EAF7F07B2899698800B287F5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; 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>"; };
|
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>"; };
|
EAF7F0C5289DA24F00B287F5 /* ArtifactoryItems.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ArtifactoryItems.txt; sourceTree = "<group>"; };
|
||||||
@ -261,7 +263,8 @@
|
|||||||
EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */,
|
EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */,
|
||||||
EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */,
|
EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */,
|
||||||
EAA5EEAC28EB6924003B3210 /* TextEntryFieldViewController.swift */,
|
EAA5EEAC28EB6924003B3210 /* TextEntryFieldViewController.swift */,
|
||||||
EAC9257F29119FC400091998 /* TextLink.swift */,
|
EAC9257F29119FC400091998 /* TextLinkViewController.swift */,
|
||||||
|
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */,
|
||||||
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
||||||
);
|
);
|
||||||
path = ViewControllers;
|
path = ViewControllers;
|
||||||
@ -423,11 +426,12 @@
|
|||||||
EA89204728B66CE2006B9984 /* KeyboardFrameChangeListener.swift in Sources */,
|
EA89204728B66CE2006B9984 /* KeyboardFrameChangeListener.swift in Sources */,
|
||||||
EA4DB30428DCD25B00103EE3 /* BadgeViewController.swift in Sources */,
|
EA4DB30428DCD25B00103EE3 /* BadgeViewController.swift in Sources */,
|
||||||
EA89204828B66CE2006B9984 /* ScrollViewKeyboardAvoiding.swift in Sources */,
|
EA89204828B66CE2006B9984 /* ScrollViewKeyboardAvoiding.swift in Sources */,
|
||||||
|
EA0FC2C12912DC5500DF80B4 /* TextLinkCaretViewController.swift in Sources */,
|
||||||
EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */,
|
EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */,
|
||||||
EA89204E28B67332006B9984 /* CheckBoxGroupViewController.swift in Sources */,
|
EA89204E28B67332006B9984 /* CheckBoxGroupViewController.swift in Sources */,
|
||||||
EAA5EEAD28EB6924003B3210 /* TextEntryFieldViewController.swift in Sources */,
|
EAA5EEAD28EB6924003B3210 /* TextEntryFieldViewController.swift in Sources */,
|
||||||
EA89204928B66CE2006B9984 /* KeyboardFrameChangeListening.swift in Sources */,
|
EA89204928B66CE2006B9984 /* KeyboardFrameChangeListening.swift in Sources */,
|
||||||
EAC9258029119FC400091998 /* TextLink.swift in Sources */,
|
EAC9258029119FC400091998 /* TextLinkViewController.swift in Sources */,
|
||||||
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */,
|
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */,
|
||||||
EA89204B28B66CE2006B9984 /* ScrollViewKeyboardAvoider.swift in Sources */,
|
EA89204B28B66CE2006B9984 /* ScrollViewKeyboardAvoider.swift in Sources */,
|
||||||
EA84F76228BE4AE500D67ABC /* RadioSwatchGroupViewController.swift in Sources */,
|
EA84F76228BE4AE500D67ABC /* RadioSwatchGroupViewController.swift in Sources */,
|
||||||
|
|||||||
@ -29,6 +29,7 @@ class MenuViewController: UITableViewController {
|
|||||||
MenuComponent(title: "RadioSwatchGroup", viewController: RadioSwatchGroupViewController.self),
|
MenuComponent(title: "RadioSwatchGroup", viewController: RadioSwatchGroupViewController.self),
|
||||||
MenuComponent(title: "TextEntryField", viewController: TextEntryFieldViewController.self),
|
MenuComponent(title: "TextEntryField", viewController: TextEntryFieldViewController.self),
|
||||||
MenuComponent(title: "TextLink", viewController: TextLinkViewController.self),
|
MenuComponent(title: "TextLink", viewController: TextLinkViewController.self),
|
||||||
|
MenuComponent(title: "TextLinkCaret", viewController: TextLinkCaretViewController.self),
|
||||||
MenuComponent(title: "Toggle", viewController: ToggleViewController.self)
|
MenuComponent(title: "Toggle", viewController: ToggleViewController.self)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
87
VDSSample/ViewControllers/TextLinkCaretViewController.swift
Normal file
87
VDSSample/ViewControllers/TextLinkCaretViewController.swift
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
//
|
||||||
|
// TextLinkCaretViewController.swift
|
||||||
|
// VDSSample
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 11/2/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
import VDS
|
||||||
|
import VDSColorTokens
|
||||||
|
|
||||||
|
class TextLinkCaretViewController: BaseViewController {
|
||||||
|
|
||||||
|
lazy var caretPositionPickerSelectorView = {
|
||||||
|
PickerSelectorView(title: "",
|
||||||
|
picker: self.picker,
|
||||||
|
items: TextLinkCaretPosition.allCases)
|
||||||
|
}()
|
||||||
|
|
||||||
|
var disabledSwitch = UISwitch()
|
||||||
|
var textField = TextField()
|
||||||
|
let textLinkCaret = TextLinkCaret()
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
let view = UIView()
|
||||||
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
view.addSubview(textLinkCaret)
|
||||||
|
textLinkCaret.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
|
||||||
|
textLinkCaret.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
|
||||||
|
textLinkCaret.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: "Caret Position", view: caretPositionPickerSelectorView)
|
||||||
|
|
||||||
|
disabledSwitch
|
||||||
|
.publisher(for: .valueChanged)
|
||||||
|
.sink { [weak self] sender in
|
||||||
|
self?.textLinkCaret.disabled = sender.isOn
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
textField
|
||||||
|
.textPublisher
|
||||||
|
.sink { [weak self] text in
|
||||||
|
self?.textLinkCaret.text = text
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupModel() {
|
||||||
|
textLinkCaret.text = "Text Link"
|
||||||
|
|
||||||
|
textLinkCaret
|
||||||
|
.publisher(for: .touchUpInside)
|
||||||
|
.sink { control in
|
||||||
|
print("clicked me")
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
|
||||||
|
//setup UI
|
||||||
|
surfacePickerSelectorView.text = textLinkCaret.surface.rawValue
|
||||||
|
disabledSwitch.isOn = textLinkCaret.disabled
|
||||||
|
textField.text = textLinkCaret.text
|
||||||
|
caretPositionPickerSelectorView.text = textLinkCaret.iconPosition.rawValue
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupPicker(){
|
||||||
|
|
||||||
|
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
|
self?.textLinkCaret.surface = item
|
||||||
|
self?.contentTopView.backgroundColor = item.color
|
||||||
|
}
|
||||||
|
|
||||||
|
caretPositionPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
|
self?.textLinkCaret.iconPosition = item
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user