Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftretain cycles and capture listsSingle-choice MCQ

In the code below, what happens with regard to memory after `makeCounter()` returns?

class Box { var value = 0 } func makeCounter() -> () -> Int { let box = Box() let increment: () -> Int = { box.value += 1 return box.value } return increment } let counter = makeCounter()