Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Jason Donmoyer
PLUS
Jason Donmoyer
Courses Plus Student 21,529 Points

Soccor Coordinator help

Hi, I'm just starting out with the Soccer Coordinator app for the iOS tech degree. I think I created a dictionary for each soccer player, ( i.e. let player1 = [name: "name", height: "height, experience: "YES", guardian: "guardianName"), with each players information assigned to each key. I then created an array the dictionaries, (let array = [player1, player2, player3, ect.). I'mm having trouble with iterating through the dictionaries to sort the players by their attributes. Any help would be greatly appreciated.

Kurt Gengenbach
Kurt Gengenbach
7,994 Points

Jason, I am not sure if we are allowed to use any of the array sorting capabilities or not cause they weren't really covered, so one option I am working on is to add some metadata for each player to aid in a home-grown iterative sort, i.e. a sort tag made up of experience and height, for example This way, I am not using something that maybe wasn't covered, will comment that this would have been preferred, but will simply iterate and flag-as-assigned through my array of players until all consumed and assigned to the three teams. Thinking maybe a player with experience and 42" high could be tagged for sorting purposes as 142, and a player without experience and 46" high might be 046. Then I work down from high to low. Just a thought.