0
你能解释一下为什么会出现这种错误,什么是最好的解决这个问题类型初始化器的属性是什么时候?编译错误初始化与包含封闭
class A {
init(_ closure: @escaping() ->()) {
print("")
}
}
class B {
var s: String?
lazy var a = A {
self.s = ""
}
}
error: use of unresolved identifier 'self'
self.s = ""
^~~~
下面是详细的说明https://stackoverflow.com/questions/38118429/swift-lazy-instantiating-using-self – Sahil