【发布时间】:2021-01-14 10:17:33
【问题描述】:
默认代码:
struct ContentView: View {
var body: some View {
Text("Hello World!")
}
}
我猜上面的代码应该等价于下面的代码:
struct ContentView: View {
var body: some View = {
Text("Hello World!")
}()
}
甚至更全面:
struct ContentView: View {
var body: some View = {
() -> Text in
return Text("Hello World!")
}()
}
我只想知道在哪里可以找到第一个代码块中body 的初始化语法的引用?我在the swift programming lanauage 书swift.org 的闭包章节中没有找到任何关于这种语法的描述。
【问题讨论】:
-
您好,欢迎您,您能澄清一下您要解决的具体问题是什么吗?