diff --git a/README.md b/README.md index 4efb545..56bb300 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Once you have your Swift package set up, adding Alamofire as a dependency is as ```swift dependencies: [ - .package(url: "https://github.com/nimblehq/JSONMapper.git", .upToNextMajor(from: "1.0.0")) + .package(url: "https://github.com/nimblehq/JSONMapper.git", .upToNextMajor(from: "1.0.1")) ] ``` diff --git a/Sources/JSONMapper/Extensions/Encodable+Dictionary.swift b/Sources/JSONMapper/Extensions/Encodable+Dictionary.swift deleted file mode 100644 index 47833cb..0000000 --- a/Sources/JSONMapper/Extensions/Encodable+Dictionary.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// Encodable+Dictionary.swift -// NimbleExtension -// -// Created by Tam Nguyen on 11/17/20. -// Copyright © 2020 Nimble. All rights reserved. -// - -import Foundation - -public extension Encodable { - - func toDictionary(_ encoder: JSONEncoder = JSONEncoder()) -> [String: Any] { - guard let dictionary = try? JSONSerialization.jsonObject( - with: encoder.encode(self), options: .allowFragments - ) as? [String: Any] else { - return [:] - } - return dictionary - } -} diff --git a/Sources/JSONMapper/JSONAPIDecoder.swift b/Sources/JSONMapper/JSONAPIDecoder.swift index 844f688..b69a8c0 100644 --- a/Sources/JSONMapper/JSONAPIDecoder.swift +++ b/Sources/JSONMapper/JSONAPIDecoder.swift @@ -12,8 +12,9 @@ public class JSONAPIDecoder: JSONDecoder { private let decoder: JSONEncoder - init(decoder: JSONEncoder = JSONEncoder()) { + public init(decoder: JSONEncoder = JSONEncoder()) { self.decoder = decoder + super.init() } public override func decode(_ type: T.Type, from data: Data) throws -> T where T: Decodable {