vds_ios_sample/VDSSample/ViewControllers/NotificationViewController.swift
2023-03-15 23:06:15 +05:30

59 lines
1.6 KiB
Swift

//
// NotificationViewController.swift
// VDSSample
//
// Created by Nadigadda, Sumanth on 14/03/23.
//
import Foundation
import VDS
class NotificationViewController: BaseViewController {
var notificationView = Notification()
lazy var notificationTypePickerSelectorView = {
PickerSelectorView(title: "Info",
picker: self.picker,
items: Notification.NotificationStyle.allCases)
}()
override func viewDidLoad() {
super.viewDidLoad()
notificationView.titleLabel.text = "Good morning"
notificationView.subTitleLabel.text = "SecondLabel information"
let firstButton = Button()
firstButton.use = .secondary
firstButton.size = .small
let secondButton = Button()
secondButton.use = .primary
secondButton.size = .small
notificationView.buttonsView.buttons = [firstButton,secondButton]
addContentTopView(view: notificationView)
setupForm()
setupPicker()
}
func setupForm() {
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Style", view: notificationTypePickerSelectorView)
}
func setupPicker() {
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.notificationView.surface = item
self?.contentTopView.backgroundColor = item.color
}
notificationTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.notificationView.type = item
}
}
}