From 73cb592b921801e2cdab7b6dc77ae3dd34bcfd7e Mon Sep 17 00:00:00 2001 From: Ivan Date: Tue, 3 Dec 2019 23:50:15 +0300 Subject: [PATCH] Possible ImmutableMappable fix --- Sources/Mappable.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sources/Mappable.swift b/Sources/Mappable.swift index 3be7fc1a..2b3dad86 100644 --- a/Sources/Mappable.swift +++ b/Sources/Mappable.swift @@ -46,7 +46,7 @@ public protocol StaticMappable: BaseMappable { static func objectForMapping(map: Map) -> BaseMappable? } -public extension BaseMappable { +public extension Mappable { /// Initializes object from a JSON String init?(JSONString: String, context: MapContext? = nil) { @@ -65,12 +65,15 @@ public extension BaseMappable { return nil } } - +} + +public extension BaseMappable { + /// Returns the JSON Dictionary for the object func toJSON() -> [String: Any] { return Mapper().toJSON(self) } - + /// Returns the JSON String for the object func toJSONString(prettyPrint: Bool = false) -> String? { return Mapper().toJSONString(self, prettyPrint: prettyPrint)