|
|
|
@ -6,29 +6,45 @@
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
|
|
struct ShowAllPlayer: View {
|
|
|
|
|
@State var isShowingSheet = false
|
|
|
|
|
@Binding var players: [Player]
|
|
|
|
|
@State private var isShowingSheet = false
|
|
|
|
|
@ObservedObject var playersVM: PlayersVM
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
VStack {
|
|
|
|
|
Button(action: {
|
|
|
|
|
}) {
|
|
|
|
|
Text("Afficher les joueurs")
|
|
|
|
|
}
|
|
|
|
|
VStack(alignment: .leading) {
|
|
|
|
|
Text("Liste des joueurs actuelle :")
|
|
|
|
|
List {
|
|
|
|
|
ForEach($playersVM.players, id: \.self) { playerVM in
|
|
|
|
|
Button(action: {
|
|
|
|
|
|
|
|
|
|
}) {
|
|
|
|
|
HStack {
|
|
|
|
|
Image(systemName: "person.fill")
|
|
|
|
|
.resizable()
|
|
|
|
|
.frame(width: 30, height: 30)
|
|
|
|
|
Text(playerVM.player.name.wrappedValue)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Button(action: {
|
|
|
|
|
self.isShowingSheet = true
|
|
|
|
|
}) {
|
|
|
|
|
Text("Add Player")
|
|
|
|
|
Text("Add a player")
|
|
|
|
|
.font(.headline)
|
|
|
|
|
.foregroundColor(.white)
|
|
|
|
|
.padding()
|
|
|
|
|
.frame(maxWidth: .infinity)
|
|
|
|
|
.background(Color.red)
|
|
|
|
|
.cornerRadius(10)
|
|
|
|
|
.sheet(isPresented: $isShowingSheet) {
|
|
|
|
|
AddPlayerView(isPresented: $isShowingSheet, players: $players)
|
|
|
|
|
}
|
|
|
|
|
.padding(.horizontal)
|
|
|
|
|
}
|
|
|
|
|
.padding(.bottom)
|
|
|
|
|
.sheet(isPresented: $isShowingSheet) {
|
|
|
|
|
AddPlayerView(isPresented: $isShowingSheet, playersVM: playersVM)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|