60 lines
2.0 KiB
Swift
60 lines
2.0 KiB
Swift
//
|
|
// BreadcrumbsViewController.swift
|
|
// VDSSample
|
|
//
|
|
// Created by Kanamarlapudi, Vasavi on 05/03/24.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
import VDS
|
|
import VDSColorTokens
|
|
import Combine
|
|
|
|
class BreadcrumbsViewController: BaseViewController<Breadcrumbs> {
|
|
|
|
var selectedSwitch = Toggle()
|
|
let breadCrumbs = Breadcrumbs()
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
let label = actionLabel
|
|
addContentTopView(view: .makeWrapper(for: component))
|
|
component.breadcrumbItems = [
|
|
makeBreadcrumbItem("Home", label: label).with{ $0.link = "https://www.verizon.com/" },
|
|
makeBreadcrumbItem("Support", label: label).with{ $0.link = "https://www.verizon.com/"; $0.selectable = false },
|
|
makeBreadcrumbItem("Servie & Apps", label: label).with{ $0.link = "https://www.verizon.com/" },
|
|
makeBreadcrumbItem("My Verizon", label: label).with{ $0.link = "https://www.verizon.com/"; $0.selectable = false },
|
|
makeBreadcrumbItem("Bill", label: label).with{ $0.link = "https://www.verizon.com/" },
|
|
makeBreadcrumbItem("Billing statement FAQs", label: label).with{ $0.link = "https://www.verizon.com/"; $0.selectable = true }
|
|
]
|
|
setupPicker()
|
|
setupModel()
|
|
}
|
|
|
|
override func setupForm(){
|
|
super.setupForm()
|
|
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
|
addFormRow(label: "Last Crumb Selected", view: selectedSwitch)
|
|
|
|
selectedSwitch.onChange = { [weak self] sender in
|
|
guard let self else { return }
|
|
self.component.selected = !self.component.selected
|
|
}
|
|
}
|
|
|
|
func setupPicker(){
|
|
|
|
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
|
self?.component.surface = item
|
|
self?.contentTopView.backgroundColor = item.color
|
|
}
|
|
}
|
|
|
|
func setupModel() {
|
|
//setup UI
|
|
surfacePickerSelectorView.text = component.surface.rawValue
|
|
}
|
|
}
|