struct BDChildView: View {
@Binding var text : String
var body: some View {
VStack {
Text(text)
TextField("请输入返回值", text: $text)
}
}
}
import SwiftUI
struct BDContant: View {
@State var input:String
var body: some View {
NavigationView {
VStack{
Text("测试")
TextField("请输入", text: $input)
Button("跳转") {
}
NavigationLink(
destination: BDChildView(text: $input),
label: {
Text("Navigate")
})
}
}
}
}
struct BDContant_Previews: PreviewProvider {
static var previews: some View {
BDContant(input: "请输入")
}
}
网友评论