Explicit self capturing bug or feature?

is it a bug or a feature that i don't need capture self explicitly or implicitly in the inner closure?

class C {
    func foo() {
        DispatchQueue.main.asyncAfter(deadline: .now() + 2) { [self] in
            bar()
            DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
                baz()
            }
        }
    }
                                          
    func bar() {}
    func baz() {}
}
1 Like

Check out the discussion beginning here. This is a bug in the implementation of SE-0269 that has been filed as SR-14120.

1 Like
Terms of Service

Privacy Policy

Cookie Policy