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") ?? "" 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") return bundle.contents("\(component.self)ChangeLog")
} }
} }

View File

@ -177,7 +177,7 @@ public class BaseViewController<Component: UIView>: UIViewController, Initable ,
open override func viewDidLoad() { open override func viewDidLoad() {
super.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() let tooltip = VDS.Tooltip()
tooltip.title = "ChangeLog" tooltip.title = "ChangeLog"
tooltip.content = content tooltip.content = content

View File

@ -71,10 +71,19 @@ class CheckboxItemViewController: BaseViewController<CheckboxItem> {
} }
func setupModel() { func setupModel() {
component.labelText = "Terms and conditions" let fullText = "I accept the Terms and Conditions"
component.childText = "I agree to Verizon's terms and conditions click here" let linkText = "Terms and Conditions"
component.errorText = "Error Text" 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 //setup UI
surfacePickerSelectorView.text = component.surface.rawValue surfacePickerSelectorView.text = component.surface.rawValue
disabledSwitch.isOn = !component.isEnabled disabledSwitch.isOn = !component.isEnabled

View File

@ -78,8 +78,19 @@ class RadioBoxGroupViewController: BaseViewController<RadioBoxGroup>{
radioBox2.inputId = "model2" radioBox2.inputId = "model2"
radioBox2.value = "model 2 Value" radioBox2.value = "model 2 Value"
radioBox2.text = "iPhone 11 Bundle 2" 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] component.selectorModels = [radioBox1, radioBox2]
component.onChange = { [weak self] group in component.onChange = { [weak self] group in
@ -120,7 +131,7 @@ extension RadioBoxGroupViewController: ComponentSampleable {
radioBox1.text = "iPhone 11 Bundle 1" radioBox1.text = "iPhone 11 Bundle 1"
radioBox1.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector" radioBox1.subText = "Apple iPhone 11 - 64 GB\nOtterbox Case Red\nScreen Protector"
radioBox1.subTextRight = "Right Text" radioBox1.subTextRight = "Right Text"
var radioBox2 = RadioBoxGroup.RadioBoxItemModel() var radioBox2 = RadioBoxGroup.RadioBoxItemModel()
radioBox2.inputId = "model2" radioBox2.inputId = "model2"
radioBox2.value = "model 2 Value" radioBox2.value = "model 2 Value"