It's intrusive because you can never really stop thinking about it if you want to write correct code. Here's an example from a very interesting article by Mark Sands [1]:
How quickly can you tell whether or not this piece of code has a reference cycle?
class ServiceLayer {
// ...
private var task: URLSessionDataTask?
func foo(url: URL) {
task = URLSession.shared.dataTask(with: url) { data, response, error in
let result = // process data
DispatchQueue.main.async { [weak self] in
self?.handleResult(result)
}
}
task?.resume()
}
deinit {
task?.cancel()
}
}
In my view, reference counting does not combine very well with heavy use of closures.[1] This is an interesting read: http://marksands.github.io/2018/05/15/an-exhaustive-look-at-...