add ability to retrieve count of cached Profiles

This commit is contained in:
Bryan Montz
2023-05-13 09:18:23 -05:00
parent b5ae7df795
commit 31d327a085

View File

@@ -109,4 +109,10 @@ final class ProfileDatabase {
}
return Profile(persisted_profile: profile)
}
var count: Int {
let request = NSFetchRequest<PersistedProfile>(entityName: entity_name)
let count = try? persistent_container?.viewContext.count(for: request)
return count ?? 0
}
}