comparison GeoQuiz/Controllers/CoreDataController.swift @ 29:f5a2c2dab208

fix files structure
author Dennis C. M. <dennis@denniscm.com>
date Thu, 10 Nov 2022 10:27:28 +0100
parents GeoQuiz/Models/Controllers/CoreDataController.swift@425078c01194
children
comparison
equal deleted inserted replaced
28:f51b70c2cccc 29:f5a2c2dab208
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 }