Skip to content

Commit 6e83dce

Browse files
committed
14.0.0
1 parent 08ef7ed commit 6e83dce

30 files changed

+214
-146
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log
22

3+
## [14.0.0](https://github.com/relatedcode/ProgressHUD/releases/tag/14.0.0)
4+
5+
Released on 2023-10-14.
6+
7+
#### Added
8+
9+
- Introduced the 'SF Symbol Bounce' animation feature, allowing for the display of over 5000 animated SF Symbols to enhance visual engagement.
10+
11+
#### Changed
12+
13+
- Enhanced the existing animations through various code optimizations.
14+
315
## [13.8.6](https://github.com/relatedcode/ProgressHUD/releases/tag/13.8.6)
416

517
Released on 2023-10-13.

ProgressHUD.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'ProgressHUD'
3-
s.version = '13.8.6'
3+
s.version = '14.0.0'
44
s.license = 'MIT'
55

66
s.summary = 'A lightweight and easy-to-use Progress HUD for iOS.'

ProgressHUD/Sources/Animations/ProgressHUD+ActivityIndicator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import UIKit
1414
// MARK: - Activity Indicator
1515
extension ProgressHUD {
1616

17-
func animationActivityIndicator(_ view: UIView, _ color: UIColor) {
17+
func animationActivityIndicator(_ view: UIView) {
1818
let spinner = UIActivityIndicatorView(style: .large)
1919
let scale = view.frame.size.width / spinner.frame.size.width
2020
spinner.transform = CGAffineTransform(scaleX: scale, y: scale)
2121
spinner.frame = view.bounds
22-
spinner.color = color
22+
spinner.color = colorAnimation
2323
spinner.hidesWhenStopped = true
2424
spinner.startAnimating()
2525
view.addSubview(spinner)

ProgressHUD/Sources/Animations/ProgressHUD+BallVerticalBounce.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import UIKit
1414
// MARK: - Ball Vertical Bounce
1515
extension ProgressHUD {
1616

17-
func animationBallVerticalBounce(_ view: UIView, _ color: UIColor) {
17+
func animationBallVerticalBounce(_ view: UIView) {
1818
let line = CAShapeLayer()
19-
line.strokeColor = color.cgColor
19+
line.strokeColor = colorAnimation.cgColor
2020
line.lineWidth = view.frame.height / 15
2121
line.lineCap = .round
2222
line.fillColor = UIColor.clear.cgColor
@@ -26,14 +26,14 @@ extension ProgressHUD {
2626
let animationDownCurve = CAKeyframeAnimation(keyPath: "path")
2727
animationDownCurve.timingFunction = CAMediaTimingFunction(name: .easeOut)
2828
animationDownCurve.duration = 2.1 * speed
29-
animationDownCurve.values = [initialCurvePath(in: view).cgPath, downCurvePath(in: view).cgPath]
29+
animationDownCurve.values = [initialCurvePath(view).cgPath, downCurvePath(view).cgPath]
3030
animationDownCurve.autoreverses = true
3131
animationDownCurve.beginTime = 2.9 * speed
3232

3333
let animationTopCurve = CAKeyframeAnimation(keyPath: "path")
3434
animationTopCurve.timingFunction = CAMediaTimingFunction(name: .easeOut)
3535
animationTopCurve.duration = 0.4 * speed
36-
animationTopCurve.values = [initialCurvePath(in: view).cgPath, topCurvePath(in: view).cgPath]
36+
animationTopCurve.values = [initialCurvePath(view).cgPath, topCurvePath(view).cgPath]
3737
animationTopCurve.autoreverses = true
3838
animationTopCurve.beginTime = 7.1 * speed
3939

@@ -43,12 +43,12 @@ extension ProgressHUD {
4343
animationGroup.repeatCount = .infinity
4444

4545
line.add(animationGroup, forKey: "pathAnimation")
46-
line.path = initialCurvePath(in: view).cgPath
46+
line.path = initialCurvePath(view).cgPath
4747

48-
createBallAnimation(in: view, with: color, speed: speed)
48+
createBallAnimation(view, speed)
4949
}
5050

51-
private func initialCurvePath(in view: UIView) -> UIBezierPath {
51+
private func initialCurvePath(_ view: UIView) -> UIBezierPath {
5252
let width = view.frame.size.width
5353
let height = view.frame.size.height + view.frame.size.height / 3
5454
let path = UIBezierPath()
@@ -57,7 +57,7 @@ extension ProgressHUD {
5757
return path
5858
}
5959

60-
private func downCurvePath(in view: UIView) -> UIBezierPath {
60+
private func downCurvePath(_ view: UIView) -> UIBezierPath {
6161
let width = view.frame.size.width
6262
let height = view.frame.size.height + view.frame.size.height / 3
6363
let path = UIBezierPath()
@@ -66,7 +66,7 @@ extension ProgressHUD {
6666
return path
6767
}
6868

69-
private func topCurvePath(in view: UIView) -> UIBezierPath {
69+
private func topCurvePath(_ view: UIView) -> UIBezierPath {
7070
let width = view.frame.size.width
7171
let height = view.frame.size.height + view.frame.size.height / 3
7272
let path = UIBezierPath()
@@ -75,13 +75,13 @@ extension ProgressHUD {
7575
return path
7676
}
7777

78-
private func createBallAnimation(in view: UIView, with color: UIColor, speed: Double) {
78+
private func createBallAnimation(_ view: UIView, _ speed: Double) {
7979
let width = view.frame.size.width
8080
let height = view.frame.size.height
8181
let size = width / 4
8282
let yPosition = height - height / 3
8383

84-
let circle = drawCircleWith(CGSize(width: size, height: size), color)
84+
let circle = drawCircleWith(CGSize(width: size, height: size))
8585
circle.frame = CGRect(x: width / 2 - size / 2, y: height / 20, width: size, height: size)
8686

8787
let animation = CABasicAnimation(keyPath: "transform.translation.y")
@@ -96,15 +96,15 @@ extension ProgressHUD {
9696
view.layer.addSublayer(circle)
9797
}
9898

99-
private func drawCircleWith(_ size: CGSize, _ color: UIColor) -> CALayer {
99+
private func drawCircleWith(_ size: CGSize) -> CALayer {
100100
let path = UIBezierPath()
101101
let radius = size.width / 4
102102
let center = CGPoint(x: size.width / 2, y: size.height / 2)
103103
path.addArc(withCenter: center, radius: radius, startAngle: 0, endAngle: 2 * CGFloat.pi, clockwise: true)
104104

105105
let layer = CAShapeLayer()
106106
layer.fillColor = nil
107-
layer.strokeColor = color.cgColor
107+
layer.strokeColor = colorAnimation.cgColor
108108
layer.lineWidth = size.width / 2
109109
layer.backgroundColor = nil
110110
layer.path = path.cgPath

ProgressHUD/Sources/Animations/ProgressHUD+BarSweepToggle.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import UIKit
1414
// MARK: - Bar Sweep Toggle
1515
extension ProgressHUD {
1616

17-
func animationBarSweepToggle(_ view: UIView, _ color: UIColor) {
17+
func animationBarSweepToggle(_ view: UIView) {
1818
let height = view.frame.size.height
1919
let width = view.frame.size.width
2020

@@ -29,7 +29,7 @@ extension ProgressHUD {
2929

3030
let layerBar = CAShapeLayer()
3131
layerBar.path = pathBar.cgPath
32-
layerBar.strokeColor = color.cgColor
32+
layerBar.strokeColor = colorAnimation.cgColor
3333
layerBar.lineWidth = heightBar
3434
layerBar.lineCap = .round
3535
view.layer.addSublayer(layerBar)
@@ -65,11 +65,11 @@ extension ProgressHUD {
6565
layerBar.add(animationPosition, forKey: "position")
6666

6767
let frame = CGRect(x: -border, y: (height - heightBar) / 2 - border, width: width + 2 * border, height: heightBar + 2 * border)
68-
6968
let pathBorder = UIBezierPath(roundedRect: frame, cornerRadius: height)
69+
7070
let layerBorder = CAShapeLayer()
7171
layerBorder.path = pathBorder.cgPath
72-
layerBorder.strokeColor = color.cgColor
72+
layerBorder.strokeColor = colorAnimation.cgColor
7373
layerBorder.fillColor = UIColor.clear.cgColor
7474
layerBorder.lineWidth = border
7575
view.layer.addSublayer(layerBorder)

ProgressHUD/Sources/Animations/ProgressHUD+CircleArcDotSpin.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import UIKit
1414
// MARK: - Circle Arc Dot Spin
1515
extension ProgressHUD {
1616

17-
func animationCircleArcDotSpin(_ view: UIView, _ color: UIColor) {
17+
func animationCircleArcDotSpin(_ view: UIView) {
1818
let space = view.frame.width / 8
1919
let x = view.bounds.minX + space / 2
2020
let y = view.bounds.minY + space / 2
@@ -35,7 +35,7 @@ extension ProgressHUD {
3535
let y = center.y + radius * sin(angle)
3636

3737
let circle = UIView(frame: CGRect(x: x - size / 2, y: y - size / 2, width: size, height: size))
38-
circle.backgroundColor = color
38+
circle.backgroundColor = colorAnimation
3939
circle.layer.cornerRadius = size / 2
4040
containerView.addSubview(circle)
4141

@@ -47,10 +47,10 @@ extension ProgressHUD {
4747
circle.layer.add(animation, forKey: "circleAnimation")
4848
}
4949

50-
animateArcRotation(containerView, color)
50+
animateArcRotation(containerView)
5151
}
5252

53-
private func animateArcRotation(_ view: UIView, _ color: UIColor) {
53+
private func animateArcRotation(_ view: UIView) {
5454
let width = view.frame.size.width
5555
let height = view.frame.size.height
5656
let center = CGPoint(x: width / 2, y: height / 2)
@@ -80,7 +80,7 @@ extension ProgressHUD {
8080
layer.frame = CGRect(x: 0, y: 0, width: width, height: height)
8181
layer.path = path.cgPath
8282
layer.fillColor = nil
83-
layer.strokeColor = color.cgColor
83+
layer.strokeColor = colorAnimation.cgColor
8484
layer.lineWidth = view.frame.width / 6
8585
layer.lineCap = .round
8686

ProgressHUD/Sources/Animations/ProgressHUD+CircleBarSpinFade.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import UIKit
1414
// MARK: - Circle Bar Spin Fade
1515
extension ProgressHUD {
1616

17-
func animationCircleBarSpinFade(_ view: UIView, _ color: UIColor) {
17+
func animationCircleBarSpinFade(_ view: UIView) {
1818
let width = view.frame.size.width
1919
let height = view.frame.size.height
2020

@@ -43,15 +43,19 @@ extension ProgressHUD {
4343
let angle = .pi / 4 * CGFloat(i)
4444

4545
let line = CAShapeLayer()
46-
line.frame = CGRect(x: (containerSize - lineWidth) / 2, y: (containerSize - lineHeight) / 2, width: lineWidth, height: lineHeight)
46+
let lineX = (containerSize - lineWidth) / 2
47+
let lineY = (containerSize - lineHeight) / 2
48+
line.frame = CGRect(x: lineX, y: lineY, width: lineWidth, height: lineHeight)
4749
line.path = path.cgPath
4850
line.backgroundColor = nil
49-
line.fillColor = color.cgColor
51+
line.fillColor = colorAnimation.cgColor
5052

5153
let container = CALayer()
52-
container.frame = CGRect(x: radius * (cos(angle) + 1), y: radius * (sin(angle) + 1), width: containerSize, height: containerSize)
53-
container.addSublayer(line)
54+
let containerX = radius * (cos(angle) + 1)
55+
let containerY = radius * (sin(angle) + 1)
56+
container.frame = CGRect(x: containerX, y: containerY, width: containerSize, height: containerSize)
5457
container.sublayerTransform = CATransform3DMakeRotation(.pi / 2 + angle, 0, 0, 1)
58+
container.addSublayer(line)
5559

5660
animation.beginTime = beginTime - beginTimes[i]
5761

ProgressHUD/Sources/Animations/ProgressHUD+CircleDotSpinFade.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import UIKit
1414
// MARK: - Circle Dot Spin Fade
1515
extension ProgressHUD {
1616

17-
func animationCircleDotSpinFade(_ view: UIView, _ color: UIColor) {
17+
func animationCircleDotSpinFade(_ view: UIView) {
1818
let width = view.frame.size.width
1919

2020
let spacing = 3.0
@@ -50,7 +50,7 @@ extension ProgressHUD {
5050

5151
let layer = CAShapeLayer()
5252
layer.path = path.cgPath
53-
layer.fillColor = color.cgColor
53+
layer.fillColor = colorAnimation.cgColor
5454
layer.backgroundColor = nil
5555
layer.frame = CGRect(x: radiusX * (cos(angle) + 1), y: radiusX * (sin(angle) + 1), width: radius, height: radius)
5656

ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseMultiple.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import UIKit
1414
// MARK: - Circle Pulse Multiple
1515
extension ProgressHUD {
1616

17-
func animationCirclePulseMultiple(_ view: UIView, _ color: UIColor) {
17+
func animationCirclePulseMultiple(_ view: UIView) {
1818
let width = view.frame.size.width
1919
let height = view.frame.size.height
2020
let center = CGPoint(x: width / 2, y: height / 2)
@@ -47,7 +47,7 @@ extension ProgressHUD {
4747
let layer = CAShapeLayer()
4848
layer.frame = CGRect(x: 0, y: 0, width: width, height: height)
4949
layer.path = path.cgPath
50-
layer.fillColor = color.cgColor
50+
layer.fillColor = colorAnimation.cgColor
5151
layer.opacity = 0
5252

5353
animation.beginTime = beginTime + beginTimes[i]

ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseSingle.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import UIKit
1414
// MARK: - Circle Pulse Single
1515
extension ProgressHUD {
1616

17-
func animationCirclePulseSingle(_ view: UIView, _ color: UIColor) {
17+
func animationCirclePulseSingle(_ view: UIView) {
1818
let width = view.frame.size.width
1919
let height = view.frame.size.height
2020
let center = CGPoint(x: width / 2, y: height / 2)
@@ -44,7 +44,7 @@ extension ProgressHUD {
4444
let layer = CAShapeLayer()
4545
layer.frame = CGRect(x: 0, y: 0, width: width, height: height)
4646
layer.path = path.cgPath
47-
layer.fillColor = color.cgColor
47+
layer.fillColor = colorAnimation.cgColor
4848

4949
layer.add(animation, forKey: "animation")
5050
view.layer.addSublayer(layer)

0 commit comments

Comments
 (0)