-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathContentView.swift
80 lines (74 loc) · 2.89 KB
/
ContentView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import SwiftUI
struct ContentView: View {
@State var page = 0
@State var compliments: [String] = []
var body: some View {
ZStack {
Color.black
ZStack {
switch page {
case 0:
//Page5(compliments: $compliments)
Page1()
.frame(maxWidth: 800, alignment: .center)
case 1:
Page2()
.frame(maxWidth: 800, alignment: .center)
case 2:
Page3()
.frame(maxWidth: 800, alignment: .center)
case 3:
Page4()
.frame(maxWidth: 800, alignment: .center)
case 4:
Page5(compliments: $compliments, page: $page)
case 5:
Page6()
.frame(maxWidth: 800, alignment: .center)
case 6:
Page7(compliments: $compliments)
default:
Text("Invalid Page Number")
}
if (page < 4 || page == 5) {
HStack {
if page > 0 {
Button(action: {
withAnimation {
page -= 1
}
}) {
Image(systemName: "arrow.left")
Text("Back")
}
.foregroundColor(Color.white)
.padding(.vertical, 10)
.padding(.horizontal)
.background(Color.red)
.cornerRadius(10)
.padding(.horizontal, 10)
.transition(.asymmetric(insertion: .move(edge: .leading), removal: .move(edge: .leading)))
}
Button(action: {
withAnimation {
page += 1
}
}) {
Text("Next")
Image(systemName: "arrow.right")
}
.foregroundColor(Color.white)
.padding(.vertical, 10)
.padding(.horizontal)
.background(Color.blue)
.cornerRadius(10)
.padding(.horizontal, 10)
}
.padding(.vertical, 40)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
}
}
.preferredColorScheme(.dark)
}
}
}