DeallocationChecker 3.0.2

DeallocationChecker 3.0.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2022年6月
SPM支持SPM

Arkadiusz Holko维护。



DeallocationChecker

在不打开Instruments的情况下了解视图控制器泄漏。

Build Status

使用

首先,通过调用(例如从您的应用程序代理)启用库

#if DEBUG
    DeallocationChecker.shared.setup(with: .alert) // There are other options than .alert too!
#endif

然后,在您的视图控制器中,在重写的viewDidDisappear(_:)内部调用

override func viewDidDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)

    DeallocationChecker.shared.checkDeallocation(of: self)
}

如果某个视图控制器在完全消失后没有释放,您将看到一个有用的警报

Leaked view controller demo

此时我们可以简单地打开内存图调试器来调查循环的原因。

安装

CocoaPods

将以下行 pod "DeallocationChecker" 添加到您的 Podfile

Carthage

将以下行 github "fastred/DeallocationChecker" 添加到您的 Cartfile

作者

该项目由 Arek Holko 创建 (@arekholko 在 Twitter 上)