I have three objects nested via lists like this:
class Canteen: Object {
dynamic var name: String?
let lines = List()
}
class L
Try this:
let predicate = NSPredicate(format: "name == %@", "")
var canteens: [Canteen] = realm.objects(Canteen).filter(predicate).map { can in
// Iterate through all the Canteens
let lines: [Line] = can.lines.map { (line: Line) in
// Iterate through all the lines in each canteene
// Filter all the Meals that are NOT vegan
let meals = line.meals.filter { $0.vegan == true }
line.meals = List(meals)
return line
}
can.lines = List(lines)
return can
}