changed associated name
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
a671765e80
commit
6fb56aec19
@ -9,7 +9,7 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
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] = []
|
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
|
if let index = model.selectors.firstIndex(where: { element in
|
||||||
return element.id == viewModel.id
|
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
|
if let index = model.selectors.firstIndex(where: { element in
|
||||||
return element.id == viewModel.id
|
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) { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,23 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public protocol SelectorGroupModel<SelectorType>: Modelable, FormFieldable, Errorable {
|
public protocol SelectorGroupModel<SelectorModelType>: Modelable, FormFieldable, Errorable {
|
||||||
associatedtype SelectorType: SelectorModel
|
associatedtype SelectorModelType: SelectorModel
|
||||||
var selectors: [SelectorType] { get set }
|
var selectors: [SelectorModelType] { 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user