Swift 在闭包内调用函数时的快速强链接

Swift 在闭包内调用函数时的快速强链接,swift,closures,Swift,Closures,我对这段代码有疑问: func sendDataToBackend() { Alamofire.request(MoneyCupUsersBackEndRouter.sendBI(BudgetInsightConnectionData(budgetInsightResponse: (self.BudgetInsightJSON)!, budgetInsightPermanentToken: (self.permanentToken)!, srcDate: userData!.last

我对这段代码有疑问:

func sendDataToBackend()  {

    Alamofire.request(MoneyCupUsersBackEndRouter.sendBI(BudgetInsightConnectionData(budgetInsightResponse: (self.BudgetInsightJSON)!, budgetInsightPermanentToken: (self.permanentToken)!, srcDate: userData!.lastUpdatedAt))).validate().responseString
        { [weak self] response in

            switch response.result{
            case .success( _):
                DispatchQueue.main.async {
                    SVProgressHUD.dismiss()
                    _ = self?.navigationController?.popToRootViewController(animated: true)

                }

            case .failure(let error):
                self?.showError(title: "ERROR SENT DATA BACKEND", message: "Erreur lors de l'envoi des données au Backend", error: error)

            }
    }


}

func showError(title: String, message: String, error: Error) {
    print(title)
    print(error)
    DispatchQueue.main.async {
        SVProgressHUD.dismiss()
        let alert = UIAlertController(title: "erreur", message: message, preferredStyle:.actionSheet)
        alert.addAction(UIAlertAction(title: "OK", style: .default)
        { Void in
            _ = self.navigationController?.popToRootViewController(animated: true)}
        )
        self.present(alert, animated: true, completion: nil)
    }


}

函数showError在闭包中调用。但是这个函数也处理自我对象。既然在闭包中调用了淋浴ROR,那么我是否在调用中创建了一个对self的强引用?如果是这样的话,我能回避这个问题吗

代码中没有问题,因为
showError
捕获较弱,并且
DispatchQueue.main.async
关闭不会导致保留周期。

请查看。