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

In the following code, what happens to the memory of the `Logger` instance after `setup()` returns and `node` goes out of scope?

class Node { var onChange: (() -> Void)? let logger = Logger() func setup() { onChange = { self.logger.log("changed") } } } func make() { let node = Node() node.setup() } make()