Is self captured within a nested function

Unfortunately, only Closures have “Capture List” feature like [weak self]. For nested functions, You have to use normal weak or unowned variables.

func myInstanceMethod() {
    weak var _self = self
    func nestedFunction(result : Bool) {
        _self?.anotherInstanceMethod()
    }

    functionExpectingClosure(nestedFunction)
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)