I'm learning how to utilize table views & table view cells and today I wanted to practice using sections within table views. Setting the section title and sorting the data into those specific sections is fairly easy, especially when using enums.
To make it a bit more of a challenge, I wanted to see how difficult it would be to have the section titles based off of Team Names stored on Firebase and have the rows consist of users that are apart of that specific team. I've come to realize that this is extremely difficult for someone that's still learning Swift.
Heres how the structure looks on firebase:
The users have the ability to create their own team names & these team names will serve as the titles. So what I've done is created an array of strings, observed the team names and added them to the array. From there, I set the titles of the sections to each team name. The problem Im having is putting the correct users under each team.
If there were 40 teams, I could easily create 40 sections with the correct titles, but I can't seem to figure out how to sort each user into the correct section.
See Question&Answers more detail:os