Memory and ARC
Capture lists
What does this code print?
final class Counter { var n = 0 }
let c = Counter()
var tag = "A"
let f = { [c, tag] in print(c.n, tag) }
c.n = 5
tag = "B"
f()Pick one
Capture lists
What does this code print?
final class Counter { var n = 0 }
let c = Counter()
var tag = "A"
let f = { [c, tag] in print(c.n, tag) }
c.n = 5
tag = "B"
f()Pick one
Memory and ARCShort answerAdvanced
What actually happens in memory when a closure captures an outside variable? Using the ou…
#closure #capture-list
Memory and ARCMultiple choiceBasics
Which of these two snippets creates a reference cycle? …
#closure
Memory and ARCMultiple choiceBasics
Which of the following (with no extra measures) create a reference cycle or a permanent l…
#closure
Memory and ARCShort answerAdvanced
This code, which loads an image asynchronously in a UITableView cell, crashes now and the…
#closure