Created
July 28, 2019 21:59
-
-
Save josuesilva-hotmart/f5a3c03b0ddf7d3cb0a7bf3315e994d3 to your computer and use it in GitHub Desktop.
Revisions
-
madcato renamed this gist
Mar 21, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ extension Decodable { init(_ any: Any) throws { let data = try JSONSerialization.data(withJSONObject: any, options: .prettyPrinted) let decoder = JSONDecoder() -
madcato created this gist
Mar 21, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ extension Codable { init(_ any: Any) throws { let data = try JSONSerialization.data(withJSONObject: any, options: .prettyPrinted) let decoder = JSONDecoder() let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:sszzz" decoder.dateDecodingStrategy = .formatted(dateFormatter) self = try decoder.decode(Self.self, from: data) } }