From 8b81aae78d52f857d84d689e96d57a3a821c99a7 Mon Sep 17 00:00:00 2001 From: hiroraba Date: Mon, 21 Dec 2015 23:32:45 +0900 Subject: [PATCH] Fix transform sample for Swift2.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a22cdf15..20f410b7 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ For example, if you want to transform a JSON String value to an Int you could us ```swift let transform = TransformOf(fromJSON: { (value: String?) -> Int? in // transform value from String? to Int? - return value?.toInt() + return Int(value!) }, toJSON: { (value: Int?) -> String? in // transform value from Int? to String? if let value = value { @@ -170,7 +170,7 @@ id <- (map["id"], transform) ``` Here is a more condensed version of the above: ```swift -id <- (map["id"], TransformOf(fromJSON: { $0?.toInt() }, toJSON: { $0.map { String($0) } })) +id <- (map["id"], TransformOf(fromJSON: { Int($0!) }, toJSON: { $0.map { String($0) } })) ``` # Subclasses