-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathExampleView9.swift
More file actions
60 lines (53 loc) · 2.28 KB
/
ExampleView9.swift
File metadata and controls
60 lines (53 loc) · 2.28 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
//
// ExampleView9.swift
// StepperView_Example
//
// Created by Venkatnarayansetty, Badarinath on 6/7/20.
// Copyright © 2020 CocoaPods. All rights reserved.
//
import SwiftUI
import StepperView
struct ExampleView9: View {
// steps for vertical mode ( for adding dynamic steps , make it `@State` property)
@State var verticalSteps = [TextView(text:"Cart"),
TextView(text:"Delivery Address"),
TextView(text:"Order Summary"),
TextView(text:"Payemnt")]
// steps for horizontal mode ( for adding dynamic steps , make it `@State` property)
@State var horizontalSteps = [TextView(text:"Approval "),
TextView(text:"Shipping"),
TextView(text:"Delivery"),
TextView(text:"Tracking")]
// indications types commonn for both the modes
@State var indicationTypes = [StepperIndicationType.custom(NumberedCircleView(text: "1")),
.custom(NumberedCircleView(text: "2")),
.custom(NumberedCircleView(text: "3")),
.custom(NumberedCircleView(text: "4"))]
var body: some View {
VStack(spacing: 50) {
// vertical mode
StepperView()
.addSteps(verticalSteps)
.indicators(indicationTypes)
.stepIndicatorMode(StepperMode.vertical)
.spacing(50)
.lineOptions(StepperLineOptions.custom(1, Colors.blue(.teal).rawValue))
.onAppear {
self.verticalSteps.append(TextView(text:"Track"))
self.indicationTypes.append(StepperIndicationType.custom(NumberedCircleView(text: "5")))
}
// Horizontal mode
StepperView()
.addSteps(horizontalSteps)
.indicators(self.indicationTypes)
.stepIndicatorMode(StepperMode.horizontal)
.spacing(50)
.lineOptions(StepperLineOptions.custom(1, Colors.blue(.teal).rawValue))
.padding(.top, 20)
.onAppear {
// at specific index
self.horizontalSteps.insert( TextView(text:"Processing"), at: 1)
}
}
}
}