Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
In support to blog post
class Person {
...
}
class Apartment {
...
weak var person: Person?
...
}
var person: Person? = Person(name: "John Doe")
var apartment: Apartment? = Apartment(number: 123)
apartment.person = person
person = nil
// output:
// John Doe is being deinitialized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment