comparison GeoQuiz/ProfileModalView.swift @ 17:8dac58bb4569

fix build bug
author Dennis C. M. <dennis@denniscm.com>
date Thu, 20 Oct 2022 18:07:51 +0200
parents 1011e56b7832
children f140bb277c96
comparison
equal deleted inserted replaced
16:1011e56b7832 17:8dac58bb4569
20 ]) var playedGames: FetchedResults<PlayedGame> 20 ]) var playedGames: FetchedResults<PlayedGame>
21 21
22 @State private var showingEditModalView = false 22 @State private var showingEditModalView = false
23 23
24 var body: some View { 24 var body: some View {
25 NavigationView { 25 NavigationView {
26 ScrollView { 26 List {
27 VStack(alignment: .leading, spacing: 15) { 27 Section {
28 UserProfile(user: user, storeKitRC: storeKitRC) 28 UserProfile(user: user, storeKitRC: storeKitRC)
29 29 }
30 UserProgress(playedGames: playedGames) 30
31 31 Section {
32 ForEach(playedGames) { playedGame in 32 UserProgress(playedGames: playedGames, gameType: .guessTheFlag)
33 RecentGame(game: playedGame) 33 UserProgress(playedGames: playedGames, gameType: .guessTheCapital)
34 } 34 UserProgress(playedGames: playedGames, gameType: .guessTheCountry)
35 .onDelete(perform: deleteGame) 35 UserProgress(playedGames: playedGames, gameType: .guessThePopulation)
36 } header: {
37 Text("Progress")
38 }
39
40 Section {
41 ForEach(playedGames) { playedGame in
42 RecentGame(game: playedGame)
36 } 43 }
37 .padding() 44 .onDelete(perform: deleteGame)
45 } header: {
46 Text("Recent games")
38 } 47 }
39 .background(.customBackground) 48 }
40 .navigationTitle("Profile") 49 .background(.customBackground)
41 .navigationBarTitleDisplayMode(.inline) 50 .navigationTitle("Profile")
42 .toolbar { 51 .navigationBarTitleDisplayMode(.inline)
43 ToolbarItem(placement: .cancellationAction) { 52 .toolbar {
44 Button { 53 ToolbarItem(placement: .cancellationAction) {
45 dismiss() 54 Button {
46 } label: { 55 dismiss()
47 Label("Exit", systemImage: "multiply") 56 } label: {
48 } 57 Label("Exit", systemImage: "multiply")
49 }
50
51 ToolbarItem(placement: .navigationBarTrailing) {
52 Button("Edit") {
53 showingEditModalView = true
54 }
55 } 58 }
56 } 59 }
57 60
58 .sheet(isPresented: $showingEditModalView) { 61 ToolbarItem(placement: .navigationBarTrailing) {
59 ProfileEditModalView(user: user) 62 Button("Edit") {
63 showingEditModalView = true
64 }
60 } 65 }
61 } 66 }
67
68 .sheet(isPresented: $showingEditModalView) {
69 ProfileEditModalView(user: user)
70 }
71 }
62 72
63 } 73 }
64 74
65 private func deleteGame(at offsets: IndexSet) { 75 private func deleteGame(at offsets: IndexSet) {
66 for offset in offsets { 76 for offset in offsets {