Merge branch 'feature/textLink' into 'develop'
added textLink See merge request BPHV_MIPS/vds_ios_sample!4
This commit is contained in:
commit
59cc512a5c
@ -33,6 +33,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
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 */; };
|
||||
EA3C3B9F289966EF000CA526 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3B9E289966EF000CA526 /* SceneDelegate.swift */; };
|
||||
EA3C3BA4289966EF000CA526 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EA3C3BA2289966EF000CA526 /* Main.storyboard */; };
|
||||
@ -56,6 +57,7 @@
|
||||
EAA5EEAD28EB6924003B3210 /* TextEntryFieldViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEAC28EB6924003B3210 /* TextEntryFieldViewController.swift */; };
|
||||
EAB1D2C928AAAA1D00DAE764 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2C828AAAA1D00DAE764 /* BaseViewController.swift */; };
|
||||
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */; };
|
||||
EAC9258029119FC400091998 /* TextLinkViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAC9257F29119FC400091998 /* TextLinkViewController.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 */; };
|
||||
@ -91,6 +93,7 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
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; };
|
||||
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>"; };
|
||||
@ -120,6 +123,7 @@
|
||||
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>"; };
|
||||
EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelViewController.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>"; };
|
||||
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>"; };
|
||||
@ -259,6 +263,8 @@
|
||||
EAF7F11928A14A0E00B287F5 /* RadioButtonViewController.swift */,
|
||||
EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */,
|
||||
EAA5EEAC28EB6924003B3210 /* TextEntryFieldViewController.swift */,
|
||||
EAC9257F29119FC400091998 /* TextLinkViewController.swift */,
|
||||
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */,
|
||||
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
||||
);
|
||||
path = ViewControllers;
|
||||
@ -420,10 +426,12 @@
|
||||
EA89204728B66CE2006B9984 /* KeyboardFrameChangeListener.swift in Sources */,
|
||||
EA4DB30428DCD25B00103EE3 /* BadgeViewController.swift in Sources */,
|
||||
EA89204828B66CE2006B9984 /* ScrollViewKeyboardAvoiding.swift in Sources */,
|
||||
EA0FC2C12912DC5500DF80B4 /* TextLinkCaretViewController.swift in Sources */,
|
||||
EAF7F09C2899B92400B287F5 /* CheckboxViewController.swift in Sources */,
|
||||
EA89204E28B67332006B9984 /* CheckBoxGroupViewController.swift in Sources */,
|
||||
EAA5EEAD28EB6924003B3210 /* TextEntryFieldViewController.swift in Sources */,
|
||||
EA89204928B66CE2006B9984 /* KeyboardFrameChangeListening.swift in Sources */,
|
||||
EAC9258029119FC400091998 /* TextLinkViewController.swift in Sources */,
|
||||
EAB1D2D428AC409F00DAE764 /* LabelViewController.swift in Sources */,
|
||||
EA89204B28B66CE2006B9984 /* ScrollViewKeyboardAvoider.swift in Sources */,
|
||||
EA84F76228BE4AE500D67ABC /* RadioSwatchGroupViewController.swift in Sources */,
|
||||
|
||||
@ -28,6 +28,8 @@ 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: "TextLinkCaret", viewController: TextLinkCaretViewController.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
|
||||
}
|
||||
}
|
||||
}
|
||||
87
VDSSample/ViewControllers/TextLinkViewController.swift
Normal file
87
VDSSample/ViewControllers/TextLinkViewController.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