From a7e32f3ca4237aad93a0cd61fec796d545aab825 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 10 May 2022 12:16:30 -0500 Subject: [PATCH] removed try Signed-off-by: Matt Bruce --- MVMCore/MVMCore/Models/Extensions/Decoder+UserInfo.swift | 2 +- MVMCore/MVMCore/Models/Extensions/Decoder.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/Models/Extensions/Decoder+UserInfo.swift b/MVMCore/MVMCore/Models/Extensions/Decoder+UserInfo.swift index d9f4e04..d8ffda1 100644 --- a/MVMCore/MVMCore/Models/Extensions/Decoder+UserInfo.swift +++ b/MVMCore/MVMCore/Models/Extensions/Decoder+UserInfo.swift @@ -93,7 +93,7 @@ extension JSONDecoder { /// Helper method to initialize a JSONDecoder /// - Parameter delegateObject: Delegate Object /// - Returns: JSONDecoder - public class func create(delegateObject: DelegateObject? = nil) throws -> JSONDecoder { + public class func create(delegateObject: DelegateObject? = nil) -> JSONDecoder { let decoder = JSONDecoder() decoder.add(value: DecodingContext(), for: .contextKey) if let delegateObject = delegateObject { diff --git a/MVMCore/MVMCore/Models/Extensions/Decoder.swift b/MVMCore/MVMCore/Models/Extensions/Decoder.swift index 9a4dd94..0c0311b 100644 --- a/MVMCore/MVMCore/Models/Extensions/Decoder.swift +++ b/MVMCore/MVMCore/Models/Extensions/Decoder.swift @@ -16,7 +16,7 @@ extension JSONDecoder: AnyDecoder {} extension PropertyListDecoder: AnyDecoder {} extension Data { - public func decode(using decoder: AnyDecoder = JSONDecoder(), delegateObject: DelegateObject? = nil) throws -> T { + public func decode(using decoder: AnyDecoder = JSONDecoder.create(), delegateObject: DelegateObject? = nil) throws -> T { if let decoder = decoder as? JSONDecoder { return try decoder.decode(T.self, from: self, delegateObject: delegateObject) } else { @@ -52,7 +52,7 @@ extension Decodable { public static func decode(jsonDict: [String: Any], delegateObject: DelegateObject? = nil) throws -> Self { let jsonData = try JSONSerialization.data(withJSONObject: jsonDict) do { - let decoder = try JSONDecoder.create(delegateObject: delegateObject) + let decoder = JSONDecoder.create(delegateObject: delegateObject) return try jsonData.decode(using: decoder) } catch { throw JSONError.other(error: error)