Mercurial > public > geoquiz
comparison GeoQuiz/Components/PlayedGamesList.swift @ 20:e281791e0494
finish implementation
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 23 Oct 2022 11:48:39 +0100 |
parents | |
children | b145c408f791 |
comparison
equal
deleted
inserted
replaced
19:f140bb277c96 | 20:e281791e0494 |
---|---|
1 // | |
2 // PlayedGamesList.swift | |
3 // GeoQuiz | |
4 // | |
5 // Created by Dennis Concepción Martín on 23/10/22. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 struct PlayedGamesList: View { | |
11 var playedGames: FetchedResults<PlayedGame> | |
12 | |
13 @Environment(\.managedObjectContext) var moc | |
14 | |
15 var body: some View { | |
16 List { | |
17 ForEach(playedGames, id: \.id) { game in | |
18 RecentGame(game: game) | |
19 } | |
20 .onDelete { indexSet in | |
21 CoreDataController.deleteGame(at: indexSet, from: playedGames, with: moc) | |
22 } | |
23 } | |
24 .navigationTitle("Played games") | |
25 .navigationBarTitleDisplayMode(.inline) | |
26 .toolbar { | |
27 EditButton() | |
28 } | |
29 } | |
30 } |