realm swift takes too much time to deleteAll(). i generally have around 6k-7k Objects to be deleted using deleteAll

  Kiến thức lập trình

I’m using Realm Swift in my iOS application, and I’m facing performance issues when trying to delete a large number of objects from the database. Specifically, I have around 6,000 to 7,000 objects that I need to delete at once using the deleteAll() method, but it seems to take a significant amount of time to complete the operation.

Is there a way to track the progress of the deletion process? It would be helpful to provide feedback to users while the deletion is in progress, such as showing a progress indicator.

    func clearAllRealmData() {
        if let realm = try? Realm() {
            do {
                try realm.write {
                    realm.deleteAll()
                }
                realm.refresh()
            } catch {
                print("Error clearing data from Realm: (error)")
            }
        }
    }

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT