Strong and weak references in Swift
问题 In Objective C you can define a property as having a strong or weak reference like so: @property(strong)... @property(weak)... How is this done in swift? 回答1: Straight from the Swift Language guide: class Person { let name: String init(name: String) { self.name = name } var apartment: Apartment? deinit { println("\(name) is being deinitialized") } } class Apartment { let number: Int init(number: Int) { self.number = number } weak var tenant: Person? deinit { println("Apartment #\(number) is