Reference to generic type 'Map' requires arguments in <...> - Swift

Gau*_*rav 2 generics realm ios swift objectmapper

After updating the Xcode to 12.5 and updating all the pods , i start getting the above error in all files where mapping is happening

Reference to generic type 'Map' requires arguments in <...> Insert '<<#Key: _MapKey#>, <#Value: RealmCollectionValue#>>'

class DayPartData: Object, Mappable {
    @objc dynamic var code = 0
    @objc dynamic var text : String?

    required convenience init?(map: Map) {
        self.init()
    }

    func mapping(map: Map) {
        code <- map["code"]
        text <- map["text"]
    }
}
Run Code Online (Sandbox Code Playgroud)

am I missing something here?

Sin*_*ang 7

Realm 添加了新的集合类型 'Map<String, T> ',它就像一个字典。巧合的是,Map 是一个属于 ObjectMapper 的类。所以,你只需要在'Map'之前添加'ObjectMapper'来区分它。像这样

class DayPartData: Object, Mappable {
@objc dynamic var code = 0
@objc dynamic var text : String?
required convenience init?(map: ObjectMapper.Map) {
    self.init()
}
func mapping(map: ObjectMapper.Map) {
    code <- map["code"]
    text <- map["text"]
}
Run Code Online (Sandbox Code Playgroud)