-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathButtons.swift
72 lines (65 loc) · 2.13 KB
/
Buttons.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
import SwiftUI
struct Buttons: View {
@State var title: String = "Default button. \nNo button was pressed yet."
var body: some View {
VStack(spacing: 40) {
Text(title).multilineTextAlignment(.center)
Button("Button 1") {
self.title = "Button #1 was pressed"
}
.tint(.red)
Button(
action: {
self.title = "Button #2 was pressed"
},
label: {
Text("Button 2".uppercased())
.font(.headline)
.foregroundColor(.white)
.padding()
.background(
Color.blue
.cornerRadius(10)
.shadow(radius: 10)
)
}
)
Button(
action: {
self.title = "Button #3 was pressed"
},
label: {
Circle()
.fill(.white)
.frame(width: 75, height: 75)
.shadow(radius: 10)
.overlay(
Image(systemName: "heart.fill")
.font(.largeTitle)
.foregroundStyle(.indigo)
)
}
)
Button(
action: {
self.title = "Button #4 was pressed"
},
label: {
Text("Button 4".uppercased())
.font(.caption)
.bold()
.foregroundStyle(.gray)
.padding(.horizontal, 10)
.padding()
.background(
Capsule()
.stroke(.gray, lineWidth: 2.0)
)
}
)
}
}
}
#Preview {
Buttons()
}