This repository has been archived by the owner on May 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelloView.swift
115 lines (97 loc) · 3.5 KB
/
HelloView.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//
// HelloView.swift
// Teste
//
// Created by Anderson Sprenger on 20/04/22.
//
import SwiftUI
struct HelloView: View {
enum Page {
case hello, callToAction
}
@State var selectedPage: Page = .hello
init() {
let pageControl = UIPageControl.appearance()
pageControl.pageIndicatorTintColor = UIColor(.accentColor).withAlphaComponent(0.4)
pageControl.currentPageIndicatorTintColor = UIColor(.accentColor)
}
var body: some View {
NavigationView {
VStack {
TabView(selection: $selectedPage) {
hello
.tag(Page.hello)
callToAction
.tag(Page.callToAction)
}
.tabViewStyle(.page)
}
}
.navigationViewStyle(StackNavigationViewStyle())
}
var hello: some View {
VStack {
VStack(alignment: .leading) {
if UIDevice.current.userInterfaceIdiom == .phone {
Text("Hello! 😃")
.font(.system(size: 48, weight: .semibold))
.padding(.bottom, 20)
Text("My name is Anderson,\nand this is my \n\(Image(systemName: "applelogo"))WWDC22 Swift Student Challenge Submission!")
.fontWeight(.semibold)
}
else {
Text("Hello! 😃")
.font(.system(size: 68, weight: .semibold))
.padding(.bottom, 20)
Text("My name is Anderson, and this is my \n\(Image(systemName: "applelogo"))WWDC22 Swift Student Challenge Submission!")
.font(.title)
.fontWeight(.semibold)
}
}
.padding(24)
Button {
withAnimation {
selectedPage = .callToAction
}
} label: {
Text("Next")
}
.buttonStyle(CoolButtonStyle())
}
}
var callToAction: some View {
VStack {
VStack(alignment: .leading) {
if UIDevice.current.userInterfaceIdiom == .phone {
Text("Today, I will talk about criptography, it's history and how it works!")
.fontWeight(.semibold)
}
else {
Text("Today, I will talk about criptography, \nit's history, importance in our life, and how it works!")
.font(.title)
.fontWeight(.semibold)
}
}
.padding(24)
NavigationLink {
ContentView()
} label: {
Text("Let's dive right in!")
}
.buttonStyle(CoolButtonStyle())
.foregroundColor(.accentColor)
}
}
}
struct HelloView_Previews: PreviewProvider {
static var previews: some View {
// HelloView()
// .previewDevice("iPhone 12")
// HelloView()
// .previewDevice("iPad Pro (11-inch) (3rd generation)")
HelloView()
.previewDevice("iPad Pro (12.9-inch) (5th generation)")
// HelloView()
// .previewDevice("iPad Pro (9.7-inch)")
}
}