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
Brock Ormond
7,176 PointsExtra Credit question: Arrays/Dictionaries as arguments.
In one of the extra credit exercises, we were asked to pass in a dictionary into a func and return a tuple and I can't seem to figure out how to code it without passing every part of the dictionary individual (which is obviously not the intent). How do we pass arrays/dictionaries as arguments?
2 Answers
Team GDiz
Courses Plus Student 24,942 PointsI had the same question. You'll find the answer here https://teamtreehouse.com/forum/swift-parameters-and-tuples-extra-credit-solution
kerdeseverin
9,688 PointsTry these:
//To pass an Array
-(void) myMethodName:(NSArray *) yourArray{
}
//To pass a Dictionary
-(void) myMethodName:(NSDictionary *) yourDict{
}
//To pass both
-(void) myMethodName:(NSArray *) yourArray andMyDictionary:(NSDictionary*) yourDictionary{
}
Brock Ormond
7,176 PointsThat'd be fine in Cocoa, but I was asking in regards to Swift; sorry if I wasn't clear enough.