Skip to content

Commit

Permalink
Add keyPath section
Browse files Browse the repository at this point in the history
  • Loading branch information
onmyway133 committed Jul 6, 2017
1 parent 930e491 commit 7e66c66
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,27 @@ let dictionary = [
let model = Person(dictionary)
```

## KeyPath

Tailor supports mapping values using deep keyPath

```swift
struct Book: Mappable {

var title: String = ""
var publisherName: String = ""
var authorName: String = ""
var firstReviewerName: String = ""

init(_ map: [String : Any]) {
title <- map.resolve(keyPath: "title")
publisherName <- map.resolve(keyPath: "publisher.name")
authorName <- map.resolve(keyPath: "info.author.name")
firstReviewer <- map.resolve(keyPath: "meta.reviewers.0.info.name.first_name")
}
}
```

## Resolving value types.

Tailor supports mapping values from dictionaries using type specific functions.
Expand Down

0 comments on commit 7e66c66

Please sign in to comment.