I was wondering, is there any tool, which can help to detect memory leak caused by missing [weak self]
.
For instance, the following code contains memory leak issue caused by lack of [weak self]
class ImagePageViewController: UIPageViewController {
lazy var memoryLeak = UIAction(
title: "memory_leak",
image: nil
) { _ in
print(">>>> \(self)")
}
override func viewDidLoad() {
super.viewDidLoad()
print("\(memoryLeak)")
}
}
Is there any tool which can help us to prevent such issue? I have tried GitHub - realm/SwiftLint: A tool to enforce Swift style and conventions. but it is not able to detect such.