From ea6f04e410fdcba198a186b32ea45e33d14f4aca Mon Sep 17 00:00:00 2001 From: Kyle Hedden Date: Fri, 5 May 2023 22:03:58 -0400 Subject: [PATCH 1/3] update alert model initializer to match prop requirements. --- MVMCoreUI/Atomic/Actions/AlertModel.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Actions/AlertModel.swift b/MVMCoreUI/Atomic/Actions/AlertModel.swift index 302c48eb..889000fa 100644 --- a/MVMCoreUI/Atomic/Actions/AlertModel.swift +++ b/MVMCoreUI/Atomic/Actions/AlertModel.swift @@ -99,11 +99,12 @@ public struct AlertModel: Codable, AlertModelProtocol { // MARK: - Init //-------------------------------------------------- - public init(title: String, message: String, buttonModels: [AlertButtonModel], style: UIAlertController.Style = .alert, delegateObject: DelegateObject?) { + public init(title: String? = nil, message: String? = nil, buttonModels: [AlertButtonModel] = [], style: UIAlertController.Style = .alert, delegateObject: DelegateObject? = nil) { self.title = title self.message = message self.buttonModels = buttonModels self.preferredStyle = style + self.delegateObject = delegateObject } //-------------------------------------------------- From 73d5018cc27b18c9b7974c242d68bc2a5e187468 Mon Sep 17 00:00:00 2001 From: Kyle Hedden Date: Mon, 8 May 2023 18:39:04 -0400 Subject: [PATCH 2/3] open drop down model initializer for local building. --- .../TextFields/Dropdown Fields/BaseDropdownFieldModel.swift | 4 ++++ .../Item Dropdown/ItemDropdownEntryFieldModel.swift | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/BaseDropdownFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/BaseDropdownFieldModel.swift index 6c2131ac..d13935d5 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/BaseDropdownFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/BaseDropdownFieldModel.swift @@ -26,6 +26,10 @@ case action } + public override init(with text: String) { + super.init(with: text) + } + open override func setDefaults() { super.setDefaults() enableClipboardActions = false diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/ItemDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/ItemDropdownEntryFieldModel.swift index 75d2c887..1c88ddab 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/ItemDropdownEntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/ItemDropdownEntryFieldModel.swift @@ -16,6 +16,12 @@ public var options: [String] = [] public var selectedIndex: Int? + public init(with options: [String], selectedIndex: Int? = nil) { + self.options = options + self.selectedIndex = selectedIndex + super.init(with: options.first ?? "") + } + //-------------------------------------------------- // MARK: - Validation //-------------------------------------------------- From 4a2654dcc77cfa47514ec7b452d9e3b258ec5158 Mon Sep 17 00:00:00 2001 From: Kyle Hedden Date: Mon, 8 May 2023 20:05:05 -0400 Subject: [PATCH 3/3] Remove default buttonModel initializer. --- MVMCoreUI/Atomic/Actions/AlertModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Actions/AlertModel.swift b/MVMCoreUI/Atomic/Actions/AlertModel.swift index 7eb88109..8a36ab03 100644 --- a/MVMCoreUI/Atomic/Actions/AlertModel.swift +++ b/MVMCoreUI/Atomic/Actions/AlertModel.swift @@ -100,7 +100,7 @@ public struct AlertModel: Codable, Identifiable, AlertModelProtocol { // MARK: - Init //-------------------------------------------------- - public init(title: String? = nil, message: String? = nil, buttonModels: [AlertButtonModel] = [], style: UIAlertController.Style = .alert, delegateObject: DelegateObject? = nil, id: String = UUID().uuidString) { + public init(title: String? = nil, message: String? = nil, buttonModels: [AlertButtonModel], style: UIAlertController.Style = .alert, delegateObject: DelegateObject? = nil, id: String = UUID().uuidString) { self.title = title self.message = message self.buttonModels = buttonModels