Following is the code used by me. With this code deinit is not called, but if I comment out this line weakSelf?.tableView.reloadData() from code deinit gets called. Am I doing something wrong?
ZLNetworkHelper.sharedManager.getUserSavedAddress { (response) in
print("getUserSavedAddressFinished")
ZLProgressIndicator.stopAnimation()
if response.isSuccess && response.value != nil {
weak var weakSelf = self
guard weakSelf != nil else {
return
}
weakSelf!.address = response.value!.sorted(by: {$0.isDefault && !$1.isDefault})
weakSelf!.isExistingAddressSectionExpanded = false
if weakSelf!.address.count == 0 {
weakSelf!.title = LocalizationUtility.RCLocalizedString("ADD_ADDRESS")
}
DispatchQueue.main.async {
weakSelf!.tableView.reloadData()
}
if completion != nil {
completion!(true)
}
}
else {
let message = response.error?.localizedDescription
ZLCustomAlertVC.presentAlertInVC(self, withErrorMessage:message)
}
}