for illustration purposes, lets have classes this.
class person { dynamic var id = 0 dynamic var name = "" let doglist = list<dog>() } class dog { dynamic var id = 0 dynamic var name = "" }
if in realm database have 1 person name john 10 dogs. want retrieve john's info , 1 of dogs called "fluff" json serializing. like:
{ "personlist" : [{ "id" : 1 "name" : "john" "doglist" : [{ "id" = 0 "name" = "fluff" }] }] }
if dog objects only, i'll able this.
let dogslist = realm.objects(dog).filter({ $0.name == "fluff" })
but need information person object.
i think looking inverse relationship
class dog: object { dynamic var name = "" dynamic var age = 0 let owners = linkingobjects(fromtype: person.self, property: "doglist") }
Comments
Post a Comment