Learn Courses My Dashboard

Change Picker Data Based on Another Picker Selection

Does anyone have a link on changing the values on a picker if another picker is changed. Below I was able to change a text box but was not able to get the other picker on the page.

                    Picker("Please select a divsion", selection: $selectedDivision){
                        ForEach(player.players) {player in
                            Text(player.DivisionName!).tag(player.DivisionName!)
                            }

                        }
                        .frame(width: 100)
                                
                    Picker("Please select a team", selection:$player.TeamSelected) {
                                    ForEach(player.players) {player in
                                        if player.DivisionName == selectedDivision{
                                            Text(player.TeamName ?? "0")
                                        }
                                    }

                                }