Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftweak self in closuresSingle-choice MCQ

Compared to [weak self], how does [unowned self] behave when the closure runs after self is deallocated?

class Owner { var name = "o" var action: (() -> Void)! init() { action = { [unowned self] in print(self.name) } } } var o: Owner? = Owner() let act = o!.action! o = nil act()