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

enum instance method and method outside of the parentheses

Hi I'm a bit lost , please can someone explain in basic terms, why we call enum instance method inside parentheses and other methods outside of the parentheses relating to the same enum (or struct/class I guess).

what are the differences and what do each one do ?

many thanks

Can you provide a code example of what you are describing?

Hi Stone , thanks .sorry i haven't got any code at the moment . what I'm asking is ...

when an enum is written you can create a instance method which sits underneath the enum.

why do we do that and other times create a method/function outside of the parentheses of the enum ?

I've probably missed some basic principle of methods at some stage .

are you curious about enums in swift or objective C?

swift I'm doing enums and optionals but its probably a general question i guess for swift enums and struct etc . more to do with methods and their positioning .