Would it be possible that self gets deallocated in a closure and the system would crash?
e.g.
DispatchQueue.main.async {
self.backgroundColor = .red
}
Would it be possible that self gets deallocated in a closure and the system would crash?
e.g.
DispatchQueue.main.async {
self.backgroundColor = .red
}
No. Here you are capturing self strongly. If you didn't capture self (by using [unowned self]
in the capture list) – then it could crash.