这里是我的代码:如何使用Swift结构隐式初始值设定项?
struct Algorithm {
let category: String = ""
let title: String = ""
let fileName: String = ""
}
let a = Algorithm(
自动完成显示的唯一有效的初始化:
但我期待使用隐式初始化像
Algorithm(category: "", title: "", fileName: "")
这给出了错误:
Argument passed to call that takes no arguments
甚至有screenshots on another issue that shows this call being successfully used。
我在做什么错?
@MartinR不,它不是。如果他使用'var',即使使用初始值,他也会获得成员初始值设定项。 – matt