Reputation: 1030
I was wondering if there is any difference between those two a function-calls in a class:
self.myFuction()
VS
myFunction()
it is working in both ways. Is there the case where it's necessary to use the self-keyword?
Upvotes: 5
Views: 944
Reputation: 12015
In most cases: there is absolutely no difference. But it's more "swiftish" if you omit "self". But there is a case, when you have to use self: in closure expressions.
But since Swift 1.2, with the @noescape parameter, you can omit "self" in closures as well.
Upvotes: 6