actionType fix

This commit is contained in:
Pfeil, Scott Robert 2020-01-14 10:13:19 -05:00
parent 77af932f5d
commit 9c0bea033c
5 changed files with 7 additions and 6 deletions

View File

@ -36,8 +36,8 @@ public class ButtonModel: MoleculeProtocol {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
title = try typeContainer.decode(String.self, forKey: .title)
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.type)
style = try typeContainer.decode(ButtonStyle.self, forKey: .style)
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
style = try typeContainer.decodeIfPresent(ButtonStyle.self, forKey: .style)
}
public func encode(to encoder: Encoder) throws {

View File

@ -45,7 +45,7 @@ public class CaretLinkModel: MoleculeProtocol {
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
self.enabled = enabled
}
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.type)
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
}
public func encode(to encoder: Encoder) throws {

View File

@ -33,7 +33,7 @@ public class LinkModel: MoleculeProtocol {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
title = try typeContainer.decode(String.self, forKey: .title)
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.type)
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
self.enabled = enabled
}

View File

@ -28,7 +28,7 @@ import MVMCore
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: ListItemCodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.type)
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow)
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
style = try typeContainer.decodeIfPresent(String.self, forKey: .style)

View File

@ -24,10 +24,11 @@ import Foundation
ModelRegistry.register(TabsModel.self)
ModelRegistry.register(ScrollerModel.self)
ModelRegistry.register(CornerLabelsModel.self)
// buttons
ModelRegistry.register(LineModel.self)
// buttons
ModelRegistry.register(ButtonModel.self)
ModelRegistry.register(TwoButtonViewModel.self)
ModelRegistry.register(LinkModel.self)
// list items
ModelRegistry.register(ListItemModel.self)
ModelRegistry.register(DropDownListItemModel.self)