Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftSendable and data-race safetySingle-choice MCQ

In the snippet, the detached task captures `obj`. Why does strict concurrency reject this even though `Counter` is a class with only one field?

final class Counter { var value = 0 } func go() { let obj = Counter() Task.detached { obj.value += 1 // diagnostic here } }