Created
December 18, 2023 12:42
-
-
Save heestand-xyz/f9ff228c133d15cd6e4b42a627bd39a1 to your computer and use it in GitHub Desktop.
Swift Allocation Test
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
func allocationViewModel<T: AnyObject>(_ viewModel: inout T?, as name: String) { | |
weak var _viewModel: T? | |
autoreleasepool { | |
_viewModel = viewModel | |
viewModel = nil | |
} | |
XCTAssertNil(_viewModel, name) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment