Skip to content

Commit f0fb942

Browse files
Update SwiftUI application to match UI of other templates (#29)
Co-authored-by: Leptos <[email protected]>
1 parent 6075a85 commit f0fb942

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed
Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
11
import SwiftUI
22

33
struct ContentView: View {
4-
var body: some View {
5-
Text("Hello, world!")
6-
.padding()
7-
}
4+
@State private var items: [Date] = []
5+
6+
var body: some View {
7+
NavigationView {
8+
VStack {
9+
List {
10+
ForEach(items, id: \.self) { item in
11+
Text(item.description)
12+
}
13+
.onDelete(perform: delete)
14+
}.toolbar {
15+
ToolbarItem(placement: .navigationBarLeading) {
16+
EditButton()
17+
}
18+
}
19+
.listStyle(InsetGroupedListStyle())
20+
}
21+
.navigationTitle("Content View")
22+
.toolbar {
23+
ToolbarItem(placement: .navigationBarTrailing) {
24+
Button {
25+
withAnimation(.easeInOut) {
26+
items.insert(Date(), at: 0)
27+
}
28+
} label: {
29+
Image(systemName: "plus")
30+
}
31+
}
32+
}
33+
}
34+
}
35+
36+
func delete(at offsets: IndexSet) {
37+
items.remove(atOffsets: offsets)
38+
}
839
}

iphone_application_swiftui.nic.tar

1 KB
Binary file not shown.

0 commit comments

Comments
 (0)