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


jon kelson
jon kelson
5,149 Points

Please explain what the. " self " keyword is about in simple terms . Thank you

Please explain what the. " self " keyword is about in simple terms .

Thank you

1 Answer

Hannah Gaskins
Hannah Gaskins
14,572 Points

Hey there Jon,

That is a great question. Here is an excerpt from my Big Nerd Ranch Swift guide:

"All Swift methods have a self argument, which is used to access the instance on which the method is called."

Here is a code example from the Swift guide on methods as well:

class Counter 
    var count = 0
    func increment 
        self.count += 1

So in this case self is referring to the Counter class count property. You can see this here as well:


Is there a specific example you had? If so post it so we can check it out and chat it through.

Hope this helps a bit!