public struct Style {
public var test : Int?
public init(_ build:(Style) -> Void) {
build(self)
}
}
var s = Style { value in
value.test = 1
}
在变量声明时出现错误
Cannot find an initializer for type 'Style' that accepts an argument list of type '((_) -> _)'
有人知道为什么这段代码不能运行吗?在我看来,它是合法的代码。
顺便说一下,这个也不能运行。
var s = Style({ value in
value.test = 1
})