I have a case where a view controller method is calling another method with a closure. Inside that I'm setting up a subscription to a publisher and in
sink I'm calling a separate function on the view controller. I'm capturing
self weakly in the outer closure and seeing different results based on whether I reference
mySelf inside a
sink closure vs any other closre.
Here's the view controller's function
// settings is an observable object
// subscriptions is Set()
I have a full iOS sample that demonstrates this in a runnable state.
I don't understand why the latter leaks and the former doesn't. I thought capturing
self weak and holding on to it in the outer closure was the "best practice" in this type of situation.
Is this a Combine issue? Swift issue? My misunderstanding?