updated samples

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-06-19 17:29:10 -05:00
parent 5303fae3f6
commit 69ed21aa65
4 changed files with 27 additions and 7 deletions

View File

@ -45,7 +45,7 @@ struct VDSHelper {
return bundle.contents("ReleaseNotes") ?? ""
}
static func changeLog(for component: ViewProtocol.Type) -> String? {
static func changeLog(for component: any ViewProtocol.Type) -> String? {
return bundle.contents("\(component.self)ChangeLog")
}
}

View File

@ -177,7 +177,7 @@ public class BaseViewController<Component: UIView>: UIViewController, Initable ,
open override func viewDidLoad() {
super.viewDidLoad()
if let component = component as? ViewProtocol, let content = VDSHelper.changeLog(for: type(of: component)) {
if let component = component as? (any ViewProtocol), let content = VDSHelper.changeLog(for: type(of: component)) {
let tooltip = VDS.Tooltip()
tooltip.title = "ChangeLog"
tooltip.content = content

View File

@ -71,9 +71,18 @@ class CheckboxItemViewController: BaseViewController<CheckboxItem> {
}
func setupModel() {
component.labelText = "Terms and conditions"
component.childText = "I agree to Verizon's terms and conditions click here"
let fullText = "I accept the Terms and Conditions"
let linkText = "Terms and Conditions"
component.errorText = "Error Text"
component.childText = fullText
if let link = ActionLabelAttribute(text: fullText, linkText: linkText) {
link.action.sink { [weak self] in
guard let self else { return }
present(UIAlertController(title: "TextLink", message: "Clicked \(linkText)", preferredStyle: .alert).with{ $0.addAction(.init(title: "OK", style: .default)) }, animated: true)
}.store(in: &subscribers)
component.childTextAttributes = [link]
}
//setup UI
surfacePickerSelectorView.text = component.surface.rawValue

View File

@ -78,7 +78,18 @@ class RadioBoxGroupViewController: BaseViewController<RadioBoxGroup>{
radioBox2.inputId = "model2"
radioBox2.value = "model 2 Value"
radioBox2.text = "iPhone 11 Bundle 2"
radioBox2.subText = "Apple iPhone 11 - 128 GB\nOtterbox Case Black\nScreen Protector"
let fullText = "I accept the Terms and Conditions"
let linkText = "Terms and Conditions"
radioBox2.subText = fullText
if let link = ActionLabelAttribute(text: fullText, linkText: linkText) {
link.action.sink { [weak self] in
guard let self else { return }
present(UIAlertController(title: "TextLink", message: "Clicked \(linkText)", preferredStyle: .alert).with{ $0.addAction(.init(title: "OK", style: .default)) }, animated: true)
}.store(in: &subscribers)
radioBox2.subTextAttributes = [link]
}
component.selectorModels = [radioBox1, radioBox2]