Skip to content

Commit cab4e7b

Browse files
committed
[README] Make key props static in deserialization example
1 parent abaeb79 commit cab4e7b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,21 @@ While you can basically adopt the `Convertible` protocol for any type, if your t
102102
Example:
103103
```swift
104104
class User: Deserializable {
105-
let idKey = "id"
106-
let emailKey = "email"
107-
let nameKey = "name"
108-
let avatarURLKey = "avatar_url"
105+
static let idKey = "id"
106+
static let emailKey = "email"
107+
static let nameKey = "name"
108+
static let avatarURLKey = "avatar_url"
109109

110110
var id: String?
111111
var email: String?
112112
var name = "Guest"
113113
var avatarURL = NSURL(string: "https://mysite.com/assets/default-avatar.png")
114114

115115
required init(dictionary: [String : AnyObject]) throws {
116-
id <-- dictionary[idKey]
117-
email <-- dictionary[emailKey]
118-
name <-- dictionary[nameKey]
119-
avatarURL <-- dictionary[avatarURLKey]
116+
id <-- dictionary[User.idKey]
117+
email <-- dictionary[User.emailKey]
118+
name <-- dictionary[User.nameKey]
119+
avatarURL <-- dictionary[User.avatarURLKey]
120120
}
121121
}
122122
```

0 commit comments

Comments
 (0)