title: Unbox + Realm native "List" object
body: <p><strong>Update</strong></p>
  
  <blockquote>
    <p>Finally author of the <code>Unbox</code> library answer my question.
    <a href="https://github.com/JohnSundell/Unbox/issues/156" rel="nofollow noreferrer">https://github.com/JohnSundell/Unbox/issues/156</a></p>
  </blockquote>
  
  <hr>
  
  <p>I'm trying to use <code>Unbox</code> to make <code>Realm</code> object with other related objects inside using <code>List</code>. The <code>JSON</code> response from server has this structure.</p>
  
  <pre><code>[
    {
      "name": "bla bla",
      "desc": "bla bla",
      "sequential": true,
      "createdAt": "2017-01-23T09:58:05.095Z",
      "hmImages": [
        {
          "urlBase": "https://blabla.com",
          "fullresPath": "/blaPath/iyba783fR81L8y.jpg",
          "id": "bla bla"
        },
        {
          "urlBase": "https://blabla.com",
          "fullresPath": "/blaPath/iyba783fR81L8y.jpg",
          "id": "bla bla"
        }
      ],
      "tags": [],
      "id": "bla bla"
    },
    {
      "name": "bla bla",
      "desc": "bla bla",
      "sequential": true,
      "createdAt": "2017-01-23T09:58:05.095Z",
      "hmImages": [
        {
          "urlBase": "https://blabla.com",
          "fullresPath": "/blaPath/iyba783fR81L8y.jpg",
          "id": "bla bla"
        }
      ]
      "tags": [],
      "id": "bla bla"
    }
  ]
  </code></pre>
  
  <p>Note that root object is an <code>Array</code> of dictionaries. Every dictionary has an <code>Array</code> of image dictionaries.</p>
  
  <p>The class to save objects in <code>Realm</code> looks like this:</p>
  
  <pre><code>// MARK: - Realm
  final class Challenge: Object {
  
      dynamic var id = ""
      dynamic var name = ""
      dynamic var desc = ""
      dynamic var sequential = false
      dynamic var createdAt = Date()
      dynamic var btPlayground = ""
  
      // Relations
      let hmImages = List&lt;Image&gt;()
      let tags = List&lt;Tag&gt;()
  
      override static func primaryKey() -&gt; String? {
          return "id"
      }
  
  }
  
  // MARK: - Unboxable
  extension Challenge: Unboxable {
  
      convenience init(unboxer: Unboxer) throws {
          self.init()
  
          // Date formatter
          let dateFormatter = ISODateFormatter()
  
          id = try unboxer.unbox(key: "id")
          name = try unboxer.unbox(key: "name")
          desc = try unboxer.unbox(key: "desc")
          sequential = try unboxer.unbox(key: "sequential")
          createdAt = try unboxer.unbox(key: "createdAt", formatter: dateFormatter)
          btPlayground = try unboxer.unbox(key: "btPlayground")
  
      }
  
  }
  </code></pre>
  
  <p>The problem occurs with <code>hmImages</code> keypath. <code>Unbox</code> can't parse automatically and I need a way to do this.</p>
  
  <p>I tried <code>UnboxableByTransform</code> with something like this:</p>
  
  <pre><code>extension List&lt;T&gt;: UnboxableByTransform {
  
      public typealias UnboxRawValue = [[String:Any]]
  
      public static func transform(unboxedValue: Array&lt;[UnboxableDictionary]&gt;) -&gt; List&lt;T&gt;? {
  
  
      }
  
  }
  </code></pre>
  
  <p>but didn't work.
  Any idea?</p>
  
  <p>Thanks!</p>