Closed maimake closed 5 years ago
I wanna map array from something like this
values <- map["nested.*.item"]
Does it support wildcard path?
{ "nested": [ { "id": 1, "item": { "value": 1 } }, { "id": 2, "item": { "value": 2 } }, { "id": 3, "item": { "value": 3 } } ] }
struct Item: Mappable { var value: Int? init?(map: Map){ } mutating func mapping(map: Map) { value <- map["value"] } } struct Repo: Mappable { var values: [Item]? init?(map: Map){ } mutating func mapping(map: Map) { values <- map["nested.*.item"] } }
let repo = Mapper<Repo>().map(myJSONDictionary)
I exepected something like:
Repo(values: [Item(value:1),Item(value:2),Item(value:3)])
Repo(values: nil)
No unfortunately we don't support wildcard arguments at this time.
I wanna map array from something like this
Does it support wildcard path?
Your JSON dictionary:
Your model:
What you did:
What you expected:
I exepected something like:
What you got: