在下面的代码中,我知道
body是一个只有get一部分的计算属性。return 省略 VStack但是{ .. }Vstack 之后是什么?这是初始化还是闭包?{} 里面有什么,我认为没有任何回报。
struct ContentView: View {
var body: some View {
VStack {
MapView()
.frame(height: 300)
CircleImage()
.offset(y: -130)
.padding(.bottom, -130)
VStack(alignment: .leading) {
Text("Turtle Rock")
.font(.title)
HStack(alignment: .top) {
Text("Joshua Tree National Park")
.font(.subheadline)
Spacer()
Text("California")
.font(.subheadline)
}
}
.padding()
Spacer()
}
}
}
Run Code Online (Sandbox Code Playgroud)