refactored create(with:
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
42c203e773
commit
d879b8c71f
@ -33,7 +33,7 @@ public extension TemplateProtocol {
|
|||||||
guard let pageJSON = json else { return }
|
guard let pageJSON = json else { return }
|
||||||
let delegateObject = (self as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
let delegateObject = (self as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
|
||||||
let data = try JSONSerialization.data(withJSONObject: pageJSON)
|
let data = try JSONSerialization.data(withJSONObject: pageJSON)
|
||||||
let decoder = JSONDecoder.create(delegateObject: delegateObject)
|
let decoder = JSONDecoder.create(with: delegateObject)
|
||||||
templateModel = try decodeTemplate(using: decoder, from: data)
|
templateModel = try decodeTemplate(using: decoder, from: data)
|
||||||
|
|
||||||
// Add additional required behaviors if applicable.
|
// Add additional required behaviors if applicable.
|
||||||
|
|||||||
@ -69,7 +69,7 @@ open class TopNotificationModel: Codable {
|
|||||||
/// Decodes the top alert json to a model.
|
/// Decodes the top alert json to a model.
|
||||||
public static func decode(json: [AnyHashable: Any], delegateObject: MVMCoreUIDelegateObject?) throws -> Self {
|
public static func decode(json: [AnyHashable: Any], delegateObject: MVMCoreUIDelegateObject?) throws -> Self {
|
||||||
let data = try JSONSerialization.data(withJSONObject: json)
|
let data = try JSONSerialization.data(withJSONObject: json)
|
||||||
let decoder = JSONDecoder.create(delegateObject: delegateObject)
|
let decoder = JSONDecoder.create(with: delegateObject)
|
||||||
return try decoder.decode(self, from: data)
|
return try decoder.decode(self, from: data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user