updated for item setting
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
4aa7c867a7
commit
706005fc66
@ -56,6 +56,7 @@ public class PickerSelectorView<EnumType: RawRepresentable>: UIStackView, Picker
|
|||||||
updateSelectedIndex()
|
updateSelectedIndex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public var items: [EnumType] {
|
public var items: [EnumType] {
|
||||||
didSet { selectedIndex = 0 }
|
didSet { selectedIndex = 0 }
|
||||||
}
|
}
|
||||||
@ -117,6 +118,13 @@ public class PickerSelectorView<EnumType: RawRepresentable>: UIStackView, Picker
|
|||||||
return label
|
return label
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func set(item: EnumType) {
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.001) { [weak self] in
|
||||||
|
guard let self else { return }
|
||||||
|
self.text = "\(item.rawValue)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func title(for row: Int) -> String {
|
private func title(for row: Int) -> String {
|
||||||
guard let item = items[row].rawValue as? String else { return "" }
|
guard let item = items[row].rawValue as? String else { return "" }
|
||||||
return item
|
return item
|
||||||
|
|||||||
@ -29,8 +29,8 @@ class NotificationViewController: BaseViewController {
|
|||||||
items: Notification.NotificationStyle.allCases)
|
items: Notification.NotificationStyle.allCases)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var buttonPositionTypePickerSelectorView = {
|
lazy var layoutTypePickerSelectorView = {
|
||||||
PickerSelectorView(title: "bottom", picker: self.picker, items: Notification.ButtonsPosition.allCases)
|
PickerSelectorView(title: "vertical", picker: self.picker, items: Notification.Layout.allCases)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
@ -54,7 +54,7 @@ class NotificationViewController: BaseViewController {
|
|||||||
func setupForm() {
|
func setupForm() {
|
||||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||||
addFormRow(label: "Style", view: notificationTypePickerSelectorView)
|
addFormRow(label: "Style", view: notificationTypePickerSelectorView)
|
||||||
addFormRow(label: "Button Position", view: buttonPositionTypePickerSelectorView)
|
addFormRow(label: "Layout", view: layoutTypePickerSelectorView)
|
||||||
addFormRow(label: "Title", view: titleTextField)
|
addFormRow(label: "Title", view: titleTextField)
|
||||||
addFormRow(label: "SubTitle", view: subTitleTextField)
|
addFormRow(label: "SubTitle", view: subTitleTextField)
|
||||||
addFormRow(label: "Hide Button Group", view: buttonGroupToggle)
|
addFormRow(label: "Hide Button Group", view: buttonGroupToggle)
|
||||||
@ -113,8 +113,12 @@ class NotificationViewController: BaseViewController {
|
|||||||
self?.notificationView.type = item
|
self?.notificationView.type = item
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonPositionTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
layoutTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
self?.notificationView.buttonPosition = item
|
guard let self else { return }
|
||||||
|
self.notificationView.layout = item
|
||||||
|
if self.notificationView.layout != item {
|
||||||
|
self.layoutTypePickerSelectorView.set(item: self.notificationView.layout)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user