From dbfce2c999f6aa965ab6b7ce6c4bb8081fb8a100 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 8 Sep 2022 17:39:24 -0500 Subject: [PATCH] refactored again, removed protocol and enforce base class of subject Signed-off-by: Matt Bruce --- VDS/Classes/Control.swift | 3 ++- VDS/Classes/SelectorGroupHandlerBase.swift | 4 ++-- VDS/Classes/View.swift | 2 +- VDS/Components/Checkbox/CheckboxGroup.swift | 2 +- VDS/Components/RadioBox/RadioBoxGroup.swift | 2 +- VDS/Components/RadioButton/RadioButtonGroup.swift | 2 +- VDS/Components/RadioSwatch/RadioSwatchGroup.swift | 2 +- VDS/Protocols/ModelHandlerable.swift | 8 +------- 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/VDS/Classes/Control.swift b/VDS/Classes/Control.swift index 9252f6d8..457ceaa7 100644 --- a/VDS/Classes/Control.swift +++ b/VDS/Classes/Control.swift @@ -9,7 +9,8 @@ import Foundation import UIKit import Combine -open class Control: UIControl, ModelHandlerControlable, ViewProtocol, Resettable { + +open class Control: UIControl, ModelHandlerable, ViewProtocol, Resettable { //-------------------------------------------------- // MARK: - Combine Properties diff --git a/VDS/Classes/SelectorGroupHandlerBase.swift b/VDS/Classes/SelectorGroupHandlerBase.swift index 7172b468..64bb7607 100644 --- a/VDS/Classes/SelectorGroupHandlerBase.swift +++ b/VDS/Classes/SelectorGroupHandlerBase.swift @@ -8,7 +8,7 @@ import Foundation import UIKit -public class SelectorGroupHandlerBase & UIControl>: Control, Changable { +public class SelectorGroupHandlerBase>: Control, Changable { //-------------------------------------------------- // MARK: - Public Properties @@ -97,7 +97,7 @@ public class SelectorGroupHandlerBase: SelectorGroupHandlerBase where GroupModelType.SelectorModelType == ModelHandlerType.ModelType { +public class SelectorGroupSelectedHandlerBase>: SelectorGroupHandlerBase where GroupModelType.SelectorModelType == ModelHandlerType.ModelType { public var selectedModel: ModelHandlerType.ModelType? { return model.selectedModel diff --git a/VDS/Classes/View.swift b/VDS/Classes/View.swift index 991777e9..a0ed38b2 100644 --- a/VDS/Classes/View.swift +++ b/VDS/Classes/View.swift @@ -10,7 +10,7 @@ import UIKit import Combine -open class View: UIView, ModelHandlerViewable, ViewProtocol, Resettable { +open class View: UIView, ModelHandlerable, ViewProtocol, Resettable { //-------------------------------------------------- // MARK: - Combine Properties diff --git a/VDS/Components/Checkbox/CheckboxGroup.swift b/VDS/Components/Checkbox/CheckboxGroup.swift index 1e332e90..28e01fe7 100644 --- a/VDS/Components/Checkbox/CheckboxGroup.swift +++ b/VDS/Components/Checkbox/CheckboxGroup.swift @@ -23,7 +23,7 @@ public class CheckboxGroup: CheckboxGroupBase>: SelectorGroupHandlerBase { +public class CheckboxGroupBase>: SelectorGroupHandlerBase { //-------------------------------------------------- // MARK: - Public Properties diff --git a/VDS/Components/RadioBox/RadioBoxGroup.swift b/VDS/Components/RadioBox/RadioBoxGroup.swift index 750df8e7..04fdfa13 100644 --- a/VDS/Components/RadioBox/RadioBoxGroup.swift +++ b/VDS/Components/RadioBox/RadioBoxGroup.swift @@ -31,7 +31,7 @@ public class RadioBoxGroup: RadioBoxGroupBase>: SelectorGroupSelectedHandlerBase { +public class RadioBoxGroupBase>: SelectorGroupSelectedHandlerBase { //-------------------------------------------------- // MARK: - Private Properties diff --git a/VDS/Components/RadioButton/RadioButtonGroup.swift b/VDS/Components/RadioButton/RadioButtonGroup.swift index 72b34528..c2d42266 100644 --- a/VDS/Components/RadioButton/RadioButtonGroup.swift +++ b/VDS/Components/RadioButton/RadioButtonGroup.swift @@ -34,7 +34,7 @@ public class RadioButtonGroup: RadioButtonGroupBase>: SelectorGroupSelectedHandlerBase { +public class RadioButtonGroupBase>: SelectorGroupSelectedHandlerBase { //-------------------------------------------------- // MARK: - Public Properties diff --git a/VDS/Components/RadioSwatch/RadioSwatchGroup.swift b/VDS/Components/RadioSwatch/RadioSwatchGroup.swift index 90843e68..a6e6c2fb 100644 --- a/VDS/Components/RadioSwatch/RadioSwatchGroup.swift +++ b/VDS/Components/RadioSwatch/RadioSwatchGroup.swift @@ -32,7 +32,7 @@ public class RadioSwatchGroup: RadioSwatchGroupBase>: Control, Changable, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UICollectionViewDelegate { +public class RadioSwatchGroupBase>: Control, Changable, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UICollectionViewDelegate { //-------------------------------------------------- // MARK: - Public Properties diff --git a/VDS/Protocols/ModelHandlerable.swift b/VDS/Protocols/ModelHandlerable.swift index e6c03c83..acb61aa5 100644 --- a/VDS/Protocols/ModelHandlerable.swift +++ b/VDS/Protocols/ModelHandlerable.swift @@ -9,7 +9,7 @@ import Foundation import Combine import UIKit -public protocol ModelHandlerable: AnyObject, Initable { +public protocol ModelHandlerable: AnyObject, Initable { associatedtype ModelType: Modelable var model: ModelType { get set } var modelPublisher: Published.Publisher { get } @@ -42,9 +42,3 @@ extension ModelHandlerable { .store(in: &subscribers) } } - -//enforment of a specific class, helps later with subclassing using generics -//https://sarunw.com/posts/how-to-declare-swift-protocol-for-specific-class/ -public protocol ModelHandlerControlable: ModelHandlerable, UIControl {} - -public protocol ModelHandlerViewable: ModelHandlerable, UIView {}