Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftescaping vs non-escaping closuresSingle-choice MCQ

What is the behavioral difference shown here between calling a non-escaping closure and an escaping one regarding implicit `self`?

class Loader { var value = 0 func sync(_ work: () -> Void) { work() } func async(_ work: @escaping () -> Void) { /* stored */ } func run() { sync { value += 1 } // line A async { self.value += 1 } // line B } }