Skip to content

Instantly share code, notes, and snippets.

@VojtaStavik
Last active May 8, 2019 11:45
Show Gist options
  • Save VojtaStavik/2cb2a7848b75a2da9392c4fca29cd27f to your computer and use it in GitHub Desktop.
Save VojtaStavik/2cb2a7848b75a2da9392c4fca29cd27f to your computer and use it in GitHub Desktop.
class Object { }
var a: Object? = Object()
weak var weakA = a
a = nil
print(a ?? "nil")
print(weakA ?? "nil")
print("-------------------------------------------------")
var b: Object?
b = Object()
weak var weakB = b
b = nil
print(b ?? "nil")
print(weakB ?? "nil")
@VojtaStavik
Copy link
Author

VojtaStavik commented May 8, 2019

The console output is

nil
nil
-------------------------------------------------
nil
__lldb_expr_33.Object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment