Created
October 15, 2019 14:17
-
-
Save uc-compass-bot/c740d42ea2565ec8527159cce3c8dbc1 to your computer and use it in GitHub Desktop.
Memory Checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public class MemoryChecker { | |
public static func verifyDealloc(object: AnyObject?) { | |
#if DEBUG | |
DispatchQueue.main.asyncAfter(deadline: .now() + 5) { [weak object] in | |
if let object = object { | |
fatalError("Class Not Deallocated: \(String(describing: object.classForCoder ?? object)))") | |
} | |
} | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment