问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/28675146/swift-function-calls-self-keyword-vs-without