Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

John Marley
John Marley
8,418 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,089 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,418 Points

Spot on, thank you :)

Balazs Peak
Balazs Peak
46,089 Points

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

facebook.com/puklibalazs