Closed ronakvora closed 5 years ago
objc_setAssociatedObject(self, &kEmptyDataSetSource, WeakObjectContainer(with: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
class WeakObjectContainer: NSObject {
weak var weakObject: AnyObject?
init(with weakObject: Any?) {
super.init()
self.weakObject = weakObject as AnyObject?
}
}
EmptyDataSetSource and EmptyDataSetDelgate is a weakObject for WeakObjectContainer,because associatedObject does't have weak policy. So it will not cause memory leaks.
Close this issue?
Yes
Sent from my iPhone
On Jul 29, 2019, at 5:52 PM, Beau Nouvelle notifications@github.com wrote:
Close this issue?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Not having weak delegates can result in retain cycles that cause memory leaks.
should be