Delegates and weak references
You try to declare weak var delegate: MyDelegate? and the compiler rejects it. Why, and how do you fix it?
You try to declare weak var delegate: MyDelegate? and the compiler rejects it. Why, and how do you fix it?
weak only applies to class instances, and a struct can adopt a protocol type too, so the compiler rejects it. Constrain the protocol to AnyObject to mark it class-only and it compiles.
UIKitShort answerBasics
Why did Apple design UITableView with two protocols, dataSource and delegate, instead of…
#delegate #protocol
Memory and ARCMultiple choiceIntro
Which of the following statements about weak references are correct? Select all that…
#weak
Memory and ARCShort answerBasics
A view controller doesn't seem to leave memory after you close its screen. How would you…
#weak
Memory and ARCShort answerBasics
When would you use unowned instead of weak?
#weak