Skip to content

Commit

Permalink
[PR #16] Updated Person example to use extension in the README.
Browse files Browse the repository at this point in the history
The first note below the `Person` example code refers to declaring the
`Decodable` conformance in an extension. Updated the example code to
reflect this.
  • Loading branch information
richellis authored and cnoon committed Oct 7, 2016
1 parent c4b19b9 commit 539822c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ public protocol Decodable {
The `json: Any` will typically be a `[String: Any]` instance that was created from the `JSONSerialization` APIs. Use the Elevate `Parser.parseEntity` method to define the structure of the JSON data to be validated and perform the parsing.

```swift
struct Person: Decodable {
struct Person {
let identifier: String
let name: String
let nickname: String?
let birthDate: Date
let isMember: Bool?
let addresses: [Address]
}

extension Person : Decodable {
init(json: Any) throws {
let idKeyPath = "identifier"
let nameKeyPath = "name"
Expand Down

0 comments on commit 539822c

Please sign in to comment.