-
Notifications
You must be signed in to change notification settings - Fork 3
/
ContentView.swift
91 lines (75 loc) · 2.63 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
81
82
83
84
85
86
87
88
//
// ContentView.swift
//
// Created by Abdullah Kardas on 7.09.2022.
//
import SwiftUI
import CustomToggle
// An example view showing the style in action
struct ContentView: View {
@State var isOpen:Bool = false
var body: some View {
VStack(spacing:24) {
Spacer()
HStack{
Spacer()
VStack {
Text("Style 1").bold()
BounceToggle(status: $isOpen, colorClose: .gray, colorOpen: .brown, thumbColor: .white)
.scaleEffect(1.8).padding()
}
Spacer()
VStack {
Text("Style 2").bold()
BounceToggle(status: $isOpen, colorClose: .cyan, colorOpen: .teal, thumbColor: .white,enableLine: true)
.scaleEffect(1.8).padding()
}
Spacer()
}
HStack{
Spacer()
VStack {
Text("Style 3").bold()
IconToggle(status: $isOpen)
.scaleEffect(1.8).padding()
}
Spacer()
VStack {
Text("Style 3").bold()
IconToggle(status: $isOpen, iconClose: "lock.fill", iconClsClr: .white, backClose: .red, iconOpen: "lock.open.fill", iconOpnClr: .white, backOpen: .green, thumbColor: .white)
.scaleEffect(1.8).padding()
}
Spacer()
}
HStack{
Spacer()
VStack {
Text("Style 4").bold()
IconToggle(status: $isOpen, backClose: .gray.opacity(0.4), backOpen: .indigo.opacity(0.8), thumbColor: .cyan,disableIcon: true)
.scaleEffect(1.8).padding()
}
Spacer()
VStack {
Text("Style 5").bold()
ThumbToggle(status: $isOpen, backClose: .orange, backOpen: .black, thumbColor: .white)
.scaleEffect(1.8).padding()
}
Spacer()
}
Spacer()
Capsule(style: .continuous).fill(.blue).padding().frame(width: 200, height: 80).overlay {
Text("Toggle").bold().foregroundColor(.white)
}.onTapGesture {
isOpen.toggle()
}
Spacer()
}
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif