From cacf6d85d6ef94c9c0b4def6f2853d96e277b06d Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 14 Jun 2024 14:40:08 +0200 Subject: [PATCH] :construction: Update param function --- .../Components/Player/ShowAllPlayer.swift | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/DouShouQi_App/DouShouQi_App/Components/Player/ShowAllPlayer.swift b/DouShouQi_App/DouShouQi_App/Components/Player/ShowAllPlayer.swift index 566cfb4..b0173ae 100644 --- a/DouShouQi_App/DouShouQi_App/Components/Player/ShowAllPlayer.swift +++ b/DouShouQi_App/DouShouQi_App/Components/Player/ShowAllPlayer.swift @@ -9,30 +9,14 @@ import SwiftUI import UIKit struct ShowAllPlayer: View { - @Binding var isShowingSheet: Bool + @State var isShowingSheet = false @Binding var players: [Player] - var body: some View { - Button(action: { - self.isShowingSheet = true - }) { - Text("Afficher les joueurs") - } - .sheet(isPresented: $isShowingSheet) { - PlayerSheetView(isShowingSheet: $isShowingSheet, players: $players) - } - } -} - -struct PlayerSheetView: View { - @Environment(\.dismiss) var dismiss - @Binding var isShowingSheet: Bool - @Binding var players: [Player] - var body: some View { VStack { - /*List(players, id: \.self) { player in - Text(player.name) // Assumant que Player a une propriété 'name' - }*/ + Button(action: { + }) { + Text("Afficher les joueurs") + } Button(action: { self.isShowingSheet = true }) { @@ -41,9 +25,9 @@ struct PlayerSheetView: View { .padding() .background(Color.red) .cornerRadius(10) - } - .sheet(isPresented: $isShowingSheet) { - AddPlayerView(isPresented: $isShowingSheet, players: $players) + .sheet(isPresented: $isShowingSheet) { + AddPlayerView(isPresented: $isShowingSheet, players: $players) + } } } }