-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathExampleView11.swift
More file actions
160 lines (146 loc) · 7.24 KB
/
ExampleView11.swift
File metadata and controls
160 lines (146 loc) · 7.24 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//
// ExampleView11.swift
// StepperView_Example
//
// Created by Venkatnarayansetty, Badarinath on 4/3/21.
// Copyright © 2021 CocoaPods. All rights reserved.
//
import SwiftUI
import UIKit
import StepperView
struct ExampleView11: View {
let customGreen = Color(red: 0.00, green: 0.80, blue: 0.66, opacity: 1.0)
let cells = [ CustomStepTextView(text: "Basic Details"),
CustomStepTextView(text: "Company Details"),
CustomStepTextView(text: "Subscription plan"),
CustomStepTextView(text: "Payment details")
]
//Custom Indicators to point.
let indicators = [
StepperIndicationType.custom(IndicatorImageView(name: "completed").eraseToAnyView()),
StepperIndicationType.custom(IndicatorImageView(name: "completed").eraseToAnyView()),
StepperIndicationType.custom(IndicatorImageView(name:"pending").eraseToAnyView()),
StepperIndicationType.custom(IndicatorImageView(name:"pending").eraseToAnyView())
]
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
VStack(alignment: .leading, spacing: 10) {
Section(header: Text("Horizontal").foregroundColor(Color.black).font(.headline).padding()) {
ScrollView(Axis.Set.horizontal, showsIndicators: false) {
StepperView()
.addSteps([
CustomStepTextView(text: "Card details"),
CustomStepTextView(text: "Application review"),
CustomStepTextView(text: "Authenticate OTP"),
CustomStepTextView(text: "Create password")
])
.indicators([
StepperIndicationType.custom(IndicatorImageView(name: "completed")),
StepperIndicationType.custom(IndicatorImageView(name: "completed")),
StepperIndicationType.custom(IndicatorImageView(name: "completed")),
StepperIndicationType.custom(IndicatorImageView(name:"pending"))
])
.stepIndicatorMode(StepperMode.horizontal)
.lineOptions(StepperLineOptions.rounded(4, 8, customGreen))
.stepLifeCycles([StepLifeCycle.completed, .completed, .completed, .completed, .completed ])
.spacing(70)
.padding(.all, 40)
}
ScrollView(Axis.Set.horizontal, showsIndicators: false) {
StepperView()
.addSteps(cells)
.indicators(indicators)
.stepIndicatorMode(StepperMode.horizontal)
.lineOptions(StepperLineOptions.rounded(4, 8, customGreen))
.stepLifeCycles([StepLifeCycle.completed, .completed, .pending, .pending])
.spacing(70)
.padding(.all, 40)
}
StepperView()
.addSteps([
CustomStepTextView(text: "Announced"),
CustomStepTextView(text: "Dividend Payment")
])
.indicators([
StepperIndicationType.custom(IndicatorImageView(name: "completed")),
StepperIndicationType.custom(IndicatorImageView(name: "completed"))
])
.stepIndicatorMode(StepperMode.horizontal)
.lineOptions(StepperLineOptions.rounded(4, 8, customGreen))
.stepLifeCycles([StepLifeCycle.completed, .completed ])
.spacing(70)
.padding(.all, 40)
}
Divider()
Section(header: Text("Vertical").foregroundColor(Color.black).font(.headline).padding()) {
StepperView()
.addSteps([
CustomStepTextView(text: "Card details"),
CustomStepTextView(text: "Application review"),
CustomStepTextView(text: "Authenticate OTP"),
CustomStepTextView(text: "Create password")
])
.indicators([
StepperIndicationType.custom(IndicatorImageView(name: "completed")),
StepperIndicationType.custom(IndicatorImageView(name: "completed")),
StepperIndicationType.custom(IndicatorImageView(name: "completed")),
StepperIndicationType.custom(IndicatorImageView(name:"pending"))
])
.lineOptions(StepperLineOptions.rounded(4, 8, customGreen))
.stepLifeCycles([StepLifeCycle.completed, .completed, .completed, .pending])
.spacing(40)
.padding(.leading, 50)
StepperView()
.addSteps(cells)
.indicators(indicators)
.lineOptions(StepperLineOptions.rounded(4, 8, customGreen))
.stepLifeCycles([StepLifeCycle.completed, .completed, .pending, .pending])
.spacing(40)
.padding(.leading, 50)
StepperView()
.addSteps([
CustomStepTextView(text: "Announced"),
CustomStepTextView(text: "Dividend Payment")
])
.indicators([
StepperIndicationType.custom(IndicatorImageView(name: "completed")),
StepperIndicationType.custom(IndicatorImageView(name: "completed"))
])
.lineOptions(StepperLineOptions.custom(4, customGreen))
.stepLifeCycles([StepLifeCycle.completed, .completed ])
.spacing(50)
.padding(.leading, 10)
}
}
}
}
}
struct IndicatorImageView: View {
var name:String
var body: some View {
ZStack {
Circle()
.foregroundColor(Color.white)
.overlay(Image(name)
.resizable()
.frame(width: 30, height: 30))
.frame(width: 40, height: 40)
}
}
}
struct CustomStepTextView: View {
var text:String
var body: some View {
VStack {
TextView(text: text, font: Font.system(size: 16, weight: Font.Weight.regular))
.foregroundColor(Color.black)
.frame(maxWidth: .infinity, alignment: .leading)
.offset(x: -15)
}
}
}
struct ExampleView11_Previews: PreviewProvider {
static var previews: some View {
ExampleView11()
}
}