In Swift you do not need to use self, except in a few edge cases.
Generally I prefer not to write it, because I find it distracting and unnecessary to the logic of the app. (It is required in Objective-C, but not Swift).
- The only place it is required is when writing a block of code, that gets passed to a function (animation block or SKAction block).
- Another place you may see it is when you want to use the same name in a method as a variable in a class. Usually this is some kind of setter method to pass data to your code file.
Otherwise you can leave it out. Different programmers have different programming styles. That’s why the default Xcode game project has the code written a certain way.
The code I present is in a code style that I feel is good for Swift programmers to adopt for clarity.