remove encode, decode method since actionType already handled by default encode behavior

This commit is contained in:
Xinlei(Ryan) Pan 2020-03-17 16:59:30 -04:00
parent a2c73d9d7d
commit 5b97fbfac0
2 changed files with 0 additions and 49 deletions

View File

@ -18,26 +18,4 @@ import UIKit
public var analyticsData: JSONValueDictionary?
public var title: String?
public enum CodingKeys: String, CodingKey {
case actionType
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -21,31 +21,4 @@ import Foundation
public init(pageType: String) {
self.pageType = pageType
}
public enum CodingKeys: String, CodingKey {
case actionType
case pageType
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
pageType = try typeContainer.decode(String.self, forKey: .pageType)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(pageType, forKey: .pageType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}