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

John Marley
John Marley
8,740 Points

Understanding Function Parameters

When an instance method is called, how do you ascertain which parameters are available? There have been several instances where I've created the brackets as usual "()" and not known how and if to populate them with anything, so I've pressed 'a' and it comes up with a list of the options beginning with 'a' etc.

I understand how protocols work, how to navigate the documentation and also how to use dot notation to access stored properties, I just feel confused with this aspect of function parameters.

2 Answers

Balazs Peak
Balazs Peak
46,160 Points

There are two different cases:

1, You created that function, in a class which was probably also created by you.

-> in this case, you check the function declaration, what parameters it will need

2, The function is built into the core of that programming language you use, or it is part of a commonly used extension framework, etc, so it's not you who created it.

-> in this case, you might search on Google for the name of that function, or class name + function name, and you investigate how exactly that function works (or can work by overloading), probably you will end up in the official documentation, or on StackOverflow which is a developer forum like this but it is much more populated, or maybe somewhere else, but it's most likely that you will find the answer :)

I hope this helps! Much love!

John Marley
John Marley
8,740 Points

Spot on, thank you :)

Balazs Peak
Balazs Peak
46,160 Points

You are most welcome! If you are interested in cooperation (projects, learning, etc), feel free to have me on facebook!

facebook.com/puklibalazs