mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-04-05 06:14:59 +00:00
23 lines
686 B
Swift
23 lines
686 B
Swift
//
|
|
// Encounter+Util.swift
|
|
// CovidSafe
|
|
//
|
|
// Copyright © 2020 Australian Government. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import CoreData
|
|
|
|
extension Encounter {
|
|
@nonobjc public class func deleteAll() {
|
|
EncounterDB.shared.persistentContainer?.performBackgroundTask { (backgroundContext) in
|
|
let oldFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "Encounter")
|
|
let batchDeleteRequest = NSBatchDeleteRequest(fetchRequest: oldFetchRequest)
|
|
do {
|
|
try backgroundContext.execute(batchDeleteRequest)
|
|
} catch {
|
|
DLog("Error deleting old data \(error)")
|
|
}
|
|
}
|
|
}
|
|
}
|