Now fonts are correct

This commit is contained in:
Vladimir Dubovik
2025-01-29 19:04:37 +03:00
parent 4ee81cf2ea
commit 06416138d9
17 changed files with 92 additions and 53 deletions

View File

@ -47,7 +47,27 @@ final class ClassProvider {
fatalError("Unable to load store. Error: \(error)")
}
}
}
func exists(_ lesson: ClassModel, in context: NSManagedObjectContext) -> ClassModel? {
try? context.existingObject(with: lesson.objectID) as? ClassModel
}
func delete(_ lesson: ClassModel, in context: NSManagedObjectContext) throws {
if let existingClass = exists(lesson, in: context) {
context.delete(existingClass)
Task(priority: .background) {
try await context.perform {
try context.save()
}
}
}
}
func persist(in context: NSManagedObjectContext) throws {
if context.hasChanges {
try context.save()
}
}
}