class Post: RLMObject {
var images: RLMArray!
override init(JSON:json) {
if let imagesArray = dictionary["images"].arrayObject {
let imagesItems = RLMArray(objectClassName: StringObject.className())
for dic in imagesArray {
let image = StringObject(stringValue: dic as! String)
imagesItems.addObject(image)
}
images = imagesItems
}
}
}
The code above I try to init PostModel include images property, but it alway crash in my project with:
'(null)' is not supported as an RLMArray object type. RLMArrays can only contain instances of RLMObject subclasses
I saw in the documentation for Realm Swift to use List<Foo> to declare the array property, but I don't know how to do so in my case.