Hello Code Crew,
I am looking for assistance in updating the following code with different number values to make a ForEach loop.
In the code I will share below, I would like to switch out the “1” with either 2,3, or 4. Ive asked different AI for help but none of their answers work.
Here is the code:
EditTeamButton(
displayEditTeamView: Constants.displayEditTeam1View,
teamName: Constants.user.team1Name,
teamImageExtension: Constants.user.team1ImageExtension,
teamImageHostUrl: teamImageHostUrl)
This code is for a button view that requires specific string values to be passed in. I have 4 different sets of string data for 4 different teams and I just need a way to switch out the team number, that way I am not repeating the code 4 different times and rather making a ForEach loop and passing in the numbers dynamically.
So in the EditTeamButton, the first parameter is displayEditTeamView. It needs string data. I pass in a string that is in my Constatns file called, Constants.displayEditTeam1View. I can’t simply switch that out for the actual string value because thats not going to work for the rest of the parameters. I need a way to switch out that “1” to either 2,3, or 4.
I hope that makes sense.