Created
October 16, 2024 17:14
-
-
Save loganblevins/1e3bafc3d5804b6b4292113943b605ec to your computer and use it in GitHub Desktop.
XCTestCase+teardown
This file contains hidden or 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
extension XCTestCase { | |
func trackForMemoryLeaks(_ instance: AnyObject, file: StaticString = #filePath, line: UInt = #line) { | |
addTeardownBlock { [weak instance] in | |
XCTAssertNil(instance, "Instance should have been deallocated. Potential memory leak.", file: file, line: line) | |
} | |
} | |
} |
Author
loganblevins
commented
Oct 16, 2024
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment