3

How do you properly delete objects in a realm list? Is this the proper way:

class Parent: Object {
    dynamic var children: List<Child>
}


realm.write {
        realm.delete(parent.children)
        parent.childList.removeAll()
    }

My tests are not liking this

Nate Mann
  • 695
  • 6
  • 17
  • 1
    I think it should be something like `realm.delete(parent.children)`. Here's delete documentation: https://realm.io/docs/swift/latest/api/Classes/Realm.html#/s:FC10RealmSwift5Realm6deleteFS0_FCS_6ObjectT_ – kostek Jun 22 '15 at 18:18
  • When you say "My tests are not liking this", what's going wrong? The code you shared should work – segiddins Jun 22 '15 at 20:31
  • "My tests are not liking this" is so generic, what the error you got? Did you find a solution for your case? – Ahmad F Oct 16 '16 at 06:17

0 Answers0