Returning moleculeName as type(of: self).identifier due to encoding/decoding error while converting to JsonArray or JsonDict.

This commit is contained in:
Lekshmi S 2021-03-24 21:54:22 +05:30
parent aba2d5b373
commit 8cba2a59d3
5 changed files with 1 additions and 9 deletions

View File

@ -86,7 +86,6 @@ import Foundation
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case components case components
case selectedIndexes case selectedIndexes
case delimiters case delimiters
@ -120,7 +119,6 @@ import Foundation
public override func encode(to encoder: Encoder) throws { public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder) try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(components, forKey: .components) try container.encode(components, forKey: .components)
try container.encode(selectedIndexesArray, forKey: .selectedIndexes) try container.encode(selectedIndexesArray, forKey: .selectedIndexes)
try container.encodeIfPresent(delimiterArray, forKey: .delimiters) try container.encodeIfPresent(delimiterArray, forKey: .delimiters)

View File

@ -95,7 +95,6 @@
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case placeholder case placeholder
case textAlignment case textAlignment
case enabledTextColor case enabledTextColor
@ -141,7 +140,6 @@
public override func encode(to encoder: Encoder) throws { public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder) try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(placeholder, forKey: .placeholder) try container.encodeIfPresent(placeholder, forKey: .placeholder)
try container.encodeIfPresent(textAlignment, forKey: .textAlignment) try container.encodeIfPresent(textAlignment, forKey: .textAlignment)
try container.encodeIfPresent(type, forKey: .type) try container.encodeIfPresent(type, forKey: .type)

View File

@ -30,7 +30,6 @@ import Foundation
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case peakingUI case peakingUI
case peakingArrowColor case peakingArrowColor
case analyticsData case analyticsData
@ -53,7 +52,6 @@ import Foundation
open override func encode(to encoder: Encoder) throws { open override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder) try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(peakingUI, forKey: .peakingUI) try container.encodeIfPresent(peakingUI, forKey: .peakingUI)
try container.encodeIfPresent(peakingArrowColor, forKey: .peakingArrowColor) try container.encodeIfPresent(peakingArrowColor, forKey: .peakingArrowColor)
try container.encodeIfPresent(analyticsData, forKey: .analyticsData) try container.encodeIfPresent(analyticsData, forKey: .analyticsData)

View File

@ -36,7 +36,6 @@ open class BGImageMoleculeModel: MoleculeContainerModel {
} }
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case image case image
} }
@ -54,7 +53,6 @@ open class BGImageMoleculeModel: MoleculeContainerModel {
open override func encode(to encoder: Encoder) throws { open override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder) try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(image, forKey: .image) try container.encode(image, forKey: .image)
} }
} }

View File

@ -14,7 +14,7 @@ public protocol MoleculeModelProtocol: ModelProtocol, AccessibilityModelProtocol
public extension MoleculeModelProtocol { public extension MoleculeModelProtocol {
var moleculeName: String { Self.identifier } var moleculeName: String { type(of: self).identifier }
static var categoryName: String { "\(MoleculeModelProtocol.self)" } static var categoryName: String { "\(MoleculeModelProtocol.self)" }