Alamofire, Objectmapper, Realm: Nested Objects

前端 未结 4 1289
梦谈多话
梦谈多话 2021-01-13 05:16

I\'m using Alamofire, Objectmapper, Realm and everything is working beside one thing: I can\'t map nested objects.

class Voting: Object, Mappable {

    dyna         


        
4条回答
  •  执笔经年
    2021-01-13 06:02

    The problem you're seeing is due to ObjectMapper having no knowledge of Realm's List type. It is not aware that it is a collection type, and that it must be mutated in place rather than being assigned to. You can see discussion of this, including some suggested workarounds, in ObjectMapper GitHub issue #143.

    Note also that any List properties on Object subclasses should be declared with let rather than var.

提交回复
热议问题