How can I do array mapping with objectmapper?
<p>I have a response model that looks like this:</p>

<pre><code>class ResponseModel: Mappable {

    var data: T?
    var code: Int = 0

    required init?(map: Map) {}

    func mapping(map: Map) {
        data &lt;- map["data"]
        code &lt;- map["code"]
    }
}
</code></pre>

<p>If the json-data is not an array it works:</p>

<pre><code>{"code":0,"data":{"id":"2","name":"XXX"}}
</code></pre>

<p>but if it is an array, it does not work</p>

<pre><code>{"code":0,"data":[{"id":"2","name":"XXX"},{"id":"3","name":"YYY"}]}
</code></pre>

<p>My mapping code;</p>

<pre><code>let apiResponse = Mapper&lt;ResponseModel&gt;().map(JSONObject: response.result.value)
</code></pre>

<p>For details;
I tried this code using this article : <a href="http://oramind.com/rest-client-in-swift-with-promises/" rel="noreferrer">http://oramind.com/rest-client-in-swift-with-promises/</a></p>