Skip to content

Commit 9056435

Browse files
lightsprint09matthewcheok
authored andcommitted
Better readability fortransformers (#46)
* Changes default transformers to static function to enable better readability while consuming them * Uses static variables on extension instead of static functions * make old api public to not break compatibility
1 parent 6408a99 commit 9056435

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

JSONCodable/JSONTransformer.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,13 @@ public struct JSONTransformers {
4747
encoding: {dateTimeFormatter.string(from: $0)})
4848
#endif
4949
}
50+
51+
public extension JSONTransformer {
52+
static var stringToURL: JSONTransformer<String, NSURL>{
53+
return JSONTransformers.StringToNSURL
54+
}
55+
56+
static var stringToDate: JSONTransformer<String, NSDate>{
57+
return JSONTransformers.StringToNSDate
58+
}
59+
}

0 commit comments

Comments
 (0)