Reputation: 847
A method sampleMethod()
is called from a closure with weak reference of self (self?.sampleMethod()
), within the same class. What will be the context of self which is now used in sampleMethod()
?
Will it be a weak self or a strong one?
Upvotes: 1
Views: 51
Reputation: 6114
Since method sampleMethod()
invoked successfully, it will use strong self
reference inside it body by default.
You may think about this line
self?.sampleMethod()
like this
if let s = self {
s.dynamicType.sampleMethod(s)()
}
where you just passing strong reference to instance to related class method
Upvotes: 1