From the document, we should use:
DispatchQueue(label: "background").async { autoreleasepool { let realm = try! Realm() let theDog = realm.objects(Dog.self).filter("age == 1").first try! realm.write { theDog!.age = 3 } } }
However, this usage is similar to how it is done:
DispatchQueue(label: "background", autoreleaseFrequency: .workItem).async { let realm = try! Realm() let theDog = realm.objects(Dog.self).filter("age == 1").first try! realm.write { theDog!.age = 3 } }
Can anyone confirm that the second approach works as expected?
source share