From f583ef0d2a07b4634cd4b9d689d044bd6412e9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Mon, 20 Aug 2018 19:30:59 +0200 Subject: [PATCH] Documentation --- README.md | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/README.md b/README.md index 9abe9ad58..6cf3417fe 100644 --- a/README.md +++ b/README.md @@ -2661,29 +2661,6 @@ protocol MutablePersistableRecord { } ``` -For example, here is how the Player type can customize the json format of its "achievements" JSON column: - -```swift -struct Player: Codable, FetchableRecord, PersistableRecord { - var name: String - var score: Int - var achievements: [Achievement] // stored in a JSON column - - static func databaseJSONDecoder(for column: String) -> JSONDecoder { - let decoder = JSONDecoder() - decoder.dateDecodingStrategy = .iso8601 - return decoder - } - - static func databaseJSONEncoder(for column: String) -> JSONEncoder { - let encoder = JSONEncoder() - encoder.dateEncodingStrategy = .iso8601 - encoder.outputFormatting = .sortedKeys - return encoder - } -} -``` - > :bulb: **Tip**: Make sure you set the JSONEncoder `sortedKeys` option, available from iOS 11.0+, macOS 10.13+, and watchOS 4.0+. This option makes sure that the JSON output is stable. This stability is required for [Record Comparison] to work as expected, and database observation tools such as [FetchedRecordsController](#fetchedrecordscontroller) or [RxGRDB](http://github.com/RxSwiftCommunity/RxGRDB) to accurately recognize changed records.