Skip to content

Commit b98ab1b

Browse files
author
Chasel Li
committed
add form page
1 parent 33ee34d commit b98ab1b

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Example/Example/ContentView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ struct ContentView : View {
9797
NavigationLink(destination: SectionPage()) {
9898
PageRow(title: "Section",subTitle: "用于创建带头/尾部的视图内容,一般结合 `List` 组件使用")
9999
}.frame(height: 80)
100+
NavigationLink(destination: FormPage(firstName: "", lastName: "")) {
101+
PageRow(title: "Form",subTitle: "表单视图")
102+
}
100103
}
101104
Section(header: Text("导航视图")) {
102105
NavigationLink(destination: NavigationViewPage()) {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// FormPage.swift
3+
// Example
4+
//
5+
// Created by Chasel Li on 12/26/19.
6+
// Copyright © 2019 晋先森. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
11+
struct FormPage: View {
12+
13+
@State var firstName: String
14+
@State var lastName: String
15+
16+
var body: some View {
17+
VStack {
18+
Form {
19+
TextField("First Name", text: $firstName)
20+
TextField("Last Name", text: $lastName)
21+
}
22+
}.navigationBarTitle(Text("Form"))
23+
24+
}
25+
}
26+
27+
struct FormPage_Previews: PreviewProvider {
28+
static var previews: some View {
29+
FormPage(firstName: "", lastName: "")
30+
}
31+
}

images/example/Form.png

587 KB
Loading

0 commit comments

Comments
 (0)