refactored CarouselItemModelProtocol to inherit FormFieldProtocol
update CarouselItemModel with FormFieldProtocol requirements Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
0ec10715c6
commit
27bca4e436
@ -7,7 +7,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol, EnableableModelProtocol {
|
@objcMembers open class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -19,6 +20,9 @@
|
|||||||
public var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
public var fieldValue: String?
|
public var fieldValue: String?
|
||||||
public var enabled: Bool = true
|
public var enabled: Bool = true
|
||||||
|
public var fieldKey: String?
|
||||||
|
public var groupName: String = FormValidator.defaultGroupName
|
||||||
|
public var baseValue: AnyHashable?
|
||||||
|
|
||||||
public func formFieldValue() -> AnyHashable? {
|
public func formFieldValue() -> AnyHashable? {
|
||||||
guard enabled else { return nil }
|
guard enabled else { return nil }
|
||||||
@ -34,6 +38,8 @@
|
|||||||
case peakingArrowColor
|
case peakingArrowColor
|
||||||
case analyticsData
|
case analyticsData
|
||||||
case fieldValue
|
case fieldValue
|
||||||
|
case fieldKey
|
||||||
|
case groupName
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -46,6 +52,11 @@
|
|||||||
peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor)
|
peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor)
|
||||||
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
|
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
|
||||||
fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue)
|
fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue)
|
||||||
|
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
|
||||||
|
if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) {
|
||||||
|
self.groupName = groupName
|
||||||
|
}
|
||||||
|
baseValue = fieldValue
|
||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,17 +7,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
public protocol CarouselItemModelProtocol: ContainerModelProtocol {
|
public protocol CarouselItemModelProtocol: FormFieldProtocol, ContainerModelProtocol {
|
||||||
var analyticsData: JSONValueDictionary? { get set }
|
var analyticsData: JSONValueDictionary? { get set }
|
||||||
func formFieldValue() -> AnyHashable?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension CarouselItemModelProtocol {
|
public extension CarouselItemModelProtocol {
|
||||||
|
|
||||||
var analyticsData: JSONValueDictionary? {
|
var analyticsData: JSONValueDictionary? {
|
||||||
get { nil }
|
get { nil }
|
||||||
set { analyticsData = newValue }
|
set { analyticsData = newValue }
|
||||||
}
|
}
|
||||||
|
|
||||||
func formFieldValue() -> AnyHashable? { nil }
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user