comparison GeoQuiz/Models/Controllers/CoreDataController.swift @ 26:425078c01194

refactor code
author Dennis C. M. <dennis@denniscm.com>
date Wed, 09 Nov 2022 10:30:01 +0100
parents GeoQuiz/Logic/CoreDataController.swift@f140bb277c96
children
comparison
equal deleted inserted replaced
25:b3df0f5dc750 26:425078c01194
1 //
2 // CoreDataController.swift
3 // GeoQuiz
4 //
5 // Created by Dennis Concepción Martín on 22/10/22.
6 //
7
8 import Foundation
9 import SwiftUI
10 import CoreData
11
12 class CoreDataController {
13 static func deleteGame(at offsets: IndexSet, from games: FetchedResults<PlayedGame>, with moc: NSManagedObjectContext) {
14 for offset in offsets {
15 let game = games[offset]
16 moc.delete(game)
17 }
18
19 try? moc.save()
20 }
21 }