i try loop thru list in child object in realm database. list<word>
in every topic
has 2 elements, topic.words
empty ( how can access child list every topic
in topics
?
let topics = realm().objects(topic) topic in topics { println(topic.description) //prints topic { // name_en = family; // words = rlmarray <0x7ff6b4b2a380> ( // [0] word { // name_en = mother; // }, // [1] word { // name_en = father; // } // ); //} println(topic.words) //prints // list<word> ( // // ) word in topic.words { println(word.name_en) }
what doing wrong list ? why list empty ?
my model is:
class word: object { dynamic var name_en = "" var owners: [topic] { return linkingobjects(topic.self, forproperty: "words") } override static func primarykey() -> string? { return "name_en" } } class topic: object { dynamic var name_en = "" let words = list<word>() override static func primarykey() -> string? { return "name_en" } }
for example code 1 topic
works properly:
var topic: topic? { didset { println(topic!.words) word in topic!.words { println(word.description) } }
this bug in realmswift (https://github.com/realm/realm-cocoa/issues/1876) should fixed https://github.com/realm/realm-cocoa/pull/1882.
Comments
Post a Comment