# Decodable Template Information

| Name      | Description       |
| --------- | ----------------- |
| Folder name | templates/decodable |
| Invocation example | `gyro -m <model> -t decodable …` |
| Language | Swift 3 |

This template generate code to be used with [Anviking's Decodable Swift library](https://github.com/Anviking/Decodable) (not to be confused with Swift 4's Decodable)

It generates a `Decodable` extension for each object of your data model.

# Generated Code

`Shop+Decodable.swift` :

```swift
/* DO NOT EDIT | Generated by gyro */

import protocol Decodable.Decodable
import Decodable

extension Shop: Decodable {

  static func decode(_ json: Any) throws -> Shop {
    let shop = Shop()
      shop.attrDate = try Date.decode(json => "attrDate")
      shop.attrDateCustom = try Date.decode(json => "attrDateCustom")
      shop.attrDouble = try json => "attrDouble"
      shop.attrInteger16 = try Int.decode(json => "attrInteger16")
      shop.attrInteger32 = try json => "attrInteger32"
      shop.attrInteger64 = try Int.decode(json => "attrInteger64")
    return shop
  }
}
```

# Decodable Template Information

| Name      | Description       |
| --------- | ----------------- |
| Folder name | templates/decodable |
| Invocation example | `gyro -m <model> -t decodable …` |
| Language | Swift 3 |

This template generate code to be used with [Anviking's Decodable Swift library](https://github.com/Anviking/Decodable) (not to be confused with Swift 4's Decodable)

It generates a `Decodable` extension for each object of your data model.

# Generated Code

`Shop+Decodable.swift` :

```swift
/* DO NOT EDIT | Generated by gyro */

import protocol Decodable.Decodable
import Decodable

extension Shop: Decodable {

  static func decode(_ json: Any) throws -> Shop {
    let shop = Shop()
      shop.attrDate = try Date.decode(json => "attrDate")
      shop.attrDateCustom = try Date.decode(json => "attrDateCustom")
      shop.attrDouble = try json => "attrDouble"
      shop.attrInteger16 = try Int.decode(json => "attrInteger16")
      shop.attrInteger32 = try json => "attrInteger32"
      shop.attrInteger64 = try Int.decode(json => "attrInteger64")
    return shop
  }
}
```
# Specific JSON tasks
## Ignoring specific properties
If you don't want to generate a decodable call for a specific property, just add the **JSONIgnored** attribute in the xcdatamodel property's userInfos.
Update readme for decodable JSONIgnored property
Update readme for decodable JSONIgnored property
