Skip to content
Quiz · Memory and ARC · lesson 7 of 7

Quiz — [weak self]

What does the program print (lines separated by spaces)?

SWIFT
class Screen {
    var onTap: () -> Void = {}
    init() {
        onTap = { [weak self] in print(self == nil) }
    }
    deinit { print("bye") }
}

var screen: Screen? = Screen()
let tap = screen!.onTap
screen = nil
tap()