From fd2ae60a6540915e35cbf59327ee37a7258430da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Thu, 12 Oct 2017 20:41:48 +0200 Subject: [PATCH] Fix sample code of conversion from Row to Dictionary --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f53624f68..4e1b51342 100644 --- a/README.md +++ b/README.md @@ -933,7 +933,7 @@ for (columnName, dbValue) in row { ... } // ("foo", 1), ("foo", 2) - A `[String: DatabaseValue]` dictionary that keeps leftmost value in case of duplicated column name: ```swift - let dict = Dictionary(row, uniquingKeysWith: { $0 }) + let dict = Dictionary(row, uniquingKeysWith: { (left, _) in left }) ``` - A `[String: AnyObject]` dictionary which keeps rightmost value in case of duplicated column name. This dictionary is identical to FMResultSet's resultDictionary from FMDB. It contains NSNull values for null columns, and can be shared with Objective-C: @@ -943,7 +943,7 @@ for (columnName, dbValue) in row { ... } // ("foo", 1), ("foo", 2) row.map { (column, dbValue) in (column, dbValue.storage.value as AnyObject) }, - uniquingKeysWith: { $1 }) + uniquingKeysWith: { (_, right) in right }) ``` - A `[String: Any]` dictionary that can feed, for example, JSONSerialization: @@ -953,7 +953,7 @@ for (columnName, dbValue) in row { ... } // ("foo", 1), ("foo", 2) row.map { (column, dbValue) in (column, dbValue.storage.value) }, - uniquingKeysWith: { $0 }) + uniquingKeysWith: { (left, _) in left }) ``` See the documentation of [`Dictionary.init(_:uniquingKeysWith:)`](https://developer.apple.com/documentation/swift/dictionary/2892961-init) for more information.