I am then trying to convert an object to JSON Dictionary using this (to convert a comment from one RealmComment (Realm+JSON) to an MBComment (ObjectMapper)
class func realmCommentToMbComment(realmComment: RealmComment) -> MBComment {
var newMbComment = MBComment()
let realm = try! Realm()
try! realm.write {
let JSONString = realmComment.JSONDictionary
newMbComment = Mapper<MBComment>().map(JSONString)! //this is using ObjectMapper
}
return newMbComment
}
However, this will not compile and gives me an error "Value of type RealmComment has no member JSONDictionary".
I have been trying to implement this on my current Swift project, but cannot get it working. Here is my model:
I am then trying to convert an object to JSON Dictionary using this (to convert a comment from one RealmComment (Realm+JSON) to an MBComment (ObjectMapper)
However, this will not compile and gives me an error "Value of type RealmComment has no member JSONDictionary".