Created
September 7, 2022 21:43
-
-
Save kiarashvosough1999/b9cf2259339839f2e9facc8c092e547d to your computer and use it in GitHub Desktop.
Test++Count++NSHashTable
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
class Test: NSObject { | |
deinit { | |
print("deinit") | |
} | |
} | |
let tests = NSHashTable<Test>.weakObjects() | |
var test: Test? = Test() | |
tests.add(test) | |
print("count:\(tests.count) allObjects.count\(tests.allObjects.count)") | |
test = nil | |
Timer.scheduledTimer(withTimeInterval: 2, repeats: true) { _ in | |
print("count:\(tests.count) allObjects.count:\(tests.allObjects.count)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment