Hey! Thanks for replying.
struct Team {
var number: Int
var name: String
var players: [String]
var color: Color
var mascot: String
}
struct TeamEditView: View {
var team: OlympicModel.Team
@Binding var isShowing: Bool
@State var name: String = team.name
@State var playersArray: [String] = team.players
@State var playerNameToAdd: String = ""
@State var color: Color = team.color
@State var mascot: String = team.mascot
var body: some View {
VStack(spacing: 0) {
ZStack {
Text("Edit Team").font(.headline).padding()
HStack {
Spacer()
Button(action: {
viewModel.updateTeam(teamNumber: team.number, OlympicModel.Team(number: team.number, name: name, players: playersArray, color: color, mascot: mascot))
self.isShowing = false
}, label: {Text("Done")}).padding()
}
}
Divider()
Form {
Section(header: Text("Event Details")) {
TextField("Team Name", text: $name)
}
}
}
}
}
I plan on putting some more TextFields in the form to be able to create and then be able to edit a Team.
Post
Replies
Boosts
Views
Activity
Amazing! Thanks again, OOPer!
Yeah I didn't like using Section because it made the background of the section header gray, and I couldn't figure out how to change it.. I guess I have to use it and just deal with it! Thanks :)
Yeah I've looked at that but didn't find a solution.