Skip to content

Instantly share code, notes, and snippets.

@heestand-xyz
Created December 18, 2023 12:42
Show Gist options
  • Save heestand-xyz/f9ff228c133d15cd6e4b42a627bd39a1 to your computer and use it in GitHub Desktop.
Save heestand-xyz/f9ff228c133d15cd6e4b42a627bd39a1 to your computer and use it in GitHub Desktop.
Swift Allocation Test
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