changed associated name

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-08-23 13:28:00 -05:00
parent a671765e80
commit 6fb56aec19
2 changed files with 7 additions and 23 deletions

View File

@ -9,7 +9,7 @@ import Foundation
import UIKit
import Combine
open class SelectorGroupBase<SelectorType, SelectorGroupType: SelectorGroupModel, SelectorHandlerType: SelectorBase<SelectorType>>: View<SelectorGroupType>, Changable where SelectorType == SelectorGroupType.SelectorType {
open class SelectorGroupBase<SelectorModelType, SelectorGroupType: SelectorGroupModel, SelectorHandlerType: SelectorBase<SelectorModelType>>: View<SelectorGroupType>, Changable where SelectorModelType == SelectorGroupType.SelectorModelType {
public var selectorViews: [SelectorHandlerType] = []
@ -113,7 +113,7 @@ open class SelectorGroupBase<SelectorType, SelectorGroupType: SelectorGroupModel
}
public func getCachedSelector(viewModel: SelectorType) -> SelectorType? {
public func getCachedSelector(viewModel: SelectorModelType) -> SelectorModelType? {
if let index = model.selectors.firstIndex(where: { element in
return element.id == viewModel.id
}) {
@ -123,7 +123,7 @@ open class SelectorGroupBase<SelectorType, SelectorGroupType: SelectorGroupModel
}
}
public func replace(viewModel: SelectorType){
public func replace(viewModel: SelectorModelType){
if let index = model.selectors.firstIndex(where: { element in
return element.id == viewModel.id
}) {
@ -131,6 +131,6 @@ open class SelectorGroupBase<SelectorType, SelectorGroupType: SelectorGroupModel
}
}
open func didSelect(selector: SelectorType) { }
open func didSelect(selector: SelectorModelType) { }
}

View File

@ -7,23 +7,7 @@
import Foundation
public protocol SelectorGroupModel<SelectorType>: Modelable, FormFieldable, Errorable {
associatedtype SelectorType: SelectorModel
var selectors: [SelectorType] { get set }
}
public struct DefaultSelectorGroupModel<SelectorType: SelectorModel>: SelectorGroupModel {
public var id: UUID = UUID()
public var inputId: String?
public var value: AnyHashable?
public var surface: Surface = .light
public var hasError: Bool = false
public var errorText: String?
public var disabled: Bool = false
public var selectedModel: SelectorType?
public var selectors: [SelectorType]
public init() { selectors = [] }
public init(selectors: [SelectorType]){
self.selectors = selectors
}
public protocol SelectorGroupModel<SelectorModelType>: Modelable, FormFieldable, Errorable {
associatedtype SelectorModelType: SelectorModel
var selectors: [SelectorModelType] { get set }
}