-
4 votesanswersviews
在Swift中,无主与弱参考[重复]
这个问题在这里已有答案: What is the difference between a weak reference and an unowned reference? 6个答案 如果你的狗有一个弱的参考骨,这意味着狗是这种情况下的参考'owner',它使用骨骼,但骨骼可以不存在,狗仍然可以运作(因为骨骼的参考是可选的) . 然而,对于“无主”,似乎关键字“无主”不是在所有者的引用声明中使... -
2 votesanswersviews
弱或无主或无
我有一个ViewController类,如下所示: class ViewController { var viewModel = ViewModel() viewDidLoad() { self.viewModel.showAlert = { [weak self] in self?.alert() } } ...