Created
March 27, 2023 15:04
-
-
Save fewlinesofcode/8440d4c7ed9e5b2302e955064599e111 to your computer and use it in GitHub Desktop.
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 XCTest | |
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) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment