diff GeoQuiz/ProfileModalView.swift @ 15:f1967f8cc67b

first iteration of core data
author Dennis C. M. <dennis@denniscm.com>
date Wed, 19 Oct 2022 10:04:17 +0200
parents 136928bae534
children 1011e56b7832
line wrap: on
line diff
--- a/GeoQuiz/ProfileModalView.swift	Wed Oct 19 07:56:33 2022 +0200
+++ b/GeoQuiz/ProfileModalView.swift	Wed Oct 19 10:04:17 2022 +0200
@@ -13,6 +13,11 @@
     @ObservedObject var storeKitRC: StoreKitRC
     
     @Environment(\.dismiss) var dismiss
+    @Environment(\.managedObjectContext) var moc
+    
+    @FetchRequest(sortDescriptors: [
+        SortDescriptor(\.date),
+    ]) var playedGames: FetchedResults<PlayedGame>
     
     @State private var showingEditModalView = false
     
@@ -63,8 +68,11 @@
                 }
                 
                 Section {
-                    ForEach(1..<10) { _ in
-                        Text("Hello")
+                    ForEach(playedGames) { playedGame in
+                        HStack {
+                            Text("\(playedGame.id)")
+                            Text("\(playedGame.date)")
+                        }
                     }
                 } header: {
                     Text("Recent games")