Shob-Z Shob-Z - 4 months ago 61
Swift Question

Check if realm object is deleted

Realm java has a function isValid() to check if a realm object is deleted/invalidated.

Is there a similar function to find it in realm swift?

I get 'Realm object has been deleted or invalidated' crash quite often, when updating those objects.

Answer

An object can no longer be accessed if the object has been deleted from the containing realm or if invalidate is called on the containing realm.

this is the Document of Object.invalidated

add override var isInvalidated: Bool { return super.isInvalidated } to your Object

Comments