Skip to content

Commit

Permalink
Possible ImmutableMappable fix
Browse files Browse the repository at this point in the history
  • Loading branch information
itruf committed Dec 3, 2019
1 parent 19d499c commit 73cb592
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/Mappable.swift
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit 73cb592

Please sign in to comment.