-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModelClass.swift
93 lines (77 loc) · 2.56 KB
/
ModelClass.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
//
// ModelClass.swift
// SSSwiftUIAnimations
//
// Created by Mansi Prajapati on 14/05/24.
//
import SwiftUI
struct SSProgressViewStyle {
var circleSize: CGFloat
var circleStrokeWidth: CGFloat
var arrowStrokeWidth: CGFloat
var fontSize: CGFloat
var fontWeight: Font.Weight
var progressTextColor: Color
var emptyStrokeColor: Color
var fillStrokeColor: Color
var arrowColor: Color
var allowCancelProgress: Bool
init(
circleSize: CGFloat = 200.0,
circleStrokeWidth: CGFloat = 5.0,
arrowStrokeWidth: CGFloat = 5.0,
fontSize: CGFloat = 15.0,
fontWeight: Font.Weight = .regular,
progressTextColor: Color = Color.blue,
emptyStrokeColor: Color = Color.blue.opacity(0.2),
fillStrokeColor: Color = Color.blue,
arrowColor: Color = Color.blue,
allowCancelProgress: Bool = false
) {
// Circle size
self.circleSize = max(circleSize, 100)
// Circle stroke width
self.circleStrokeWidth = max(circleStrokeWidth, 1)
// Arrow stroke width
self.arrowStrokeWidth = max(arrowStrokeWidth, 1)
// Progress text font size
self.fontSize = fontSize
// Progress text fontWeight
self.fontWeight = fontWeight
// Color of progress text percentage
self.progressTextColor = progressTextColor
// Circle's empty stroke's color
self.emptyStrokeColor = emptyStrokeColor
// Circle's fill stroke's color
self.fillStrokeColor = fillStrokeColor
// Arrow color
self.arrowColor = arrowColor
// want to allow cancellation of progress or not
self.allowCancelProgress = allowCancelProgress
}
}
struct ArrowViewParams {
var isAnimating: Bool
var initialAnim: CGFloat
var isDownward: Bool
var animationStarted: Bool
var showVerticalLine: Bool
var showPercent: Bool
init(
isAnimating: Bool = false,
progress: Double = 0.0,
doneAnimating: Bool = false,
initialAnim: CGFloat = 1.0,
isDownward: Bool = true,
animationStarted: Bool = true,
showVerticalLine: Bool = true,
showPercent: Bool = false
) {
self.isAnimating = isAnimating
self.initialAnim = initialAnim
self.isDownward = isDownward
self.animationStarted = animationStarted
self.showVerticalLine = showVerticalLine
self.showPercent = showPercent
}
}