- Hands-On Design Patterns with Swift
- Florent Vilmart Giordano Scalzo Sergio De Simone
- 59字
- 2021-07-02 14:45:05
Strong references
Strong references are the default. Any time that you set a property on an object or capture a reference inside a block, the reference count increases on the object, and the lifetime of the object is extended:
class Child {
}
class Parent {
let children: [Parent]
}
let c = MyClass()
let other = MyOtherClass(class: c)