diff --git a/CHANGELOG.md b/CHANGELOG.md index 213a288..319839a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## [14.0.0](https://github.com/relatedcode/ProgressHUD/releases/tag/14.0.0) + +Released on 2023-10-14. + +#### Added + +- Introduced the 'SF Symbol Bounce' animation feature, allowing for the display of over 5000 animated SF Symbols to enhance visual engagement. + +#### Changed + +- Enhanced the existing animations through various code optimizations. + ## [13.8.6](https://github.com/relatedcode/ProgressHUD/releases/tag/13.8.6) Released on 2023-10-13. diff --git a/ProgressHUD.podspec b/ProgressHUD.podspec index 23829fe..d9dd599 100644 --- a/ProgressHUD.podspec +++ b/ProgressHUD.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'ProgressHUD' - s.version = '13.8.6' + s.version = '14.0.0' s.license = 'MIT' s.summary = 'A lightweight and easy-to-use Progress HUD for iOS.' diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+ActivityIndicator.swift b/ProgressHUD/Sources/Animations/ProgressHUD+ActivityIndicator.swift index 3dd757b..cfb71ab 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+ActivityIndicator.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+ActivityIndicator.swift @@ -14,12 +14,12 @@ import UIKit // MARK: - Activity Indicator extension ProgressHUD { - func animationActivityIndicator(_ view: UIView, _ color: UIColor) { + func animationActivityIndicator(_ view: UIView) { let spinner = UIActivityIndicatorView(style: .large) let scale = view.frame.size.width / spinner.frame.size.width spinner.transform = CGAffineTransform(scaleX: scale, y: scale) spinner.frame = view.bounds - spinner.color = color + spinner.color = colorAnimation spinner.hidesWhenStopped = true spinner.startAnimating() view.addSubview(spinner) diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+BallVerticalBounce.swift b/ProgressHUD/Sources/Animations/ProgressHUD+BallVerticalBounce.swift index d00346c..f8efb92 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+BallVerticalBounce.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+BallVerticalBounce.swift @@ -14,9 +14,9 @@ import UIKit // MARK: - Ball Vertical Bounce extension ProgressHUD { - func animationBallVerticalBounce(_ view: UIView, _ color: UIColor) { + func animationBallVerticalBounce(_ view: UIView) { let line = CAShapeLayer() - line.strokeColor = color.cgColor + line.strokeColor = colorAnimation.cgColor line.lineWidth = view.frame.height / 15 line.lineCap = .round line.fillColor = UIColor.clear.cgColor @@ -26,14 +26,14 @@ extension ProgressHUD { let animationDownCurve = CAKeyframeAnimation(keyPath: "path") animationDownCurve.timingFunction = CAMediaTimingFunction(name: .easeOut) animationDownCurve.duration = 2.1 * speed - animationDownCurve.values = [initialCurvePath(in: view).cgPath, downCurvePath(in: view).cgPath] + animationDownCurve.values = [initialCurvePath(view).cgPath, downCurvePath(view).cgPath] animationDownCurve.autoreverses = true animationDownCurve.beginTime = 2.9 * speed let animationTopCurve = CAKeyframeAnimation(keyPath: "path") animationTopCurve.timingFunction = CAMediaTimingFunction(name: .easeOut) animationTopCurve.duration = 0.4 * speed - animationTopCurve.values = [initialCurvePath(in: view).cgPath, topCurvePath(in: view).cgPath] + animationTopCurve.values = [initialCurvePath(view).cgPath, topCurvePath(view).cgPath] animationTopCurve.autoreverses = true animationTopCurve.beginTime = 7.1 * speed @@ -43,12 +43,12 @@ extension ProgressHUD { animationGroup.repeatCount = .infinity line.add(animationGroup, forKey: "pathAnimation") - line.path = initialCurvePath(in: view).cgPath + line.path = initialCurvePath(view).cgPath - createBallAnimation(in: view, with: color, speed: speed) + createBallAnimation(view, speed) } - private func initialCurvePath(in view: UIView) -> UIBezierPath { + private func initialCurvePath(_ view: UIView) -> UIBezierPath { let width = view.frame.size.width let height = view.frame.size.height + view.frame.size.height / 3 let path = UIBezierPath() @@ -57,7 +57,7 @@ extension ProgressHUD { return path } - private func downCurvePath(in view: UIView) -> UIBezierPath { + private func downCurvePath(_ view: UIView) -> UIBezierPath { let width = view.frame.size.width let height = view.frame.size.height + view.frame.size.height / 3 let path = UIBezierPath() @@ -66,7 +66,7 @@ extension ProgressHUD { return path } - private func topCurvePath(in view: UIView) -> UIBezierPath { + private func topCurvePath(_ view: UIView) -> UIBezierPath { let width = view.frame.size.width let height = view.frame.size.height + view.frame.size.height / 3 let path = UIBezierPath() @@ -75,13 +75,13 @@ extension ProgressHUD { return path } - private func createBallAnimation(in view: UIView, with color: UIColor, speed: Double) { + private func createBallAnimation(_ view: UIView, _ speed: Double) { let width = view.frame.size.width let height = view.frame.size.height let size = width / 4 let yPosition = height - height / 3 - let circle = drawCircleWith(CGSize(width: size, height: size), color) + let circle = drawCircleWith(CGSize(width: size, height: size)) circle.frame = CGRect(x: width / 2 - size / 2, y: height / 20, width: size, height: size) let animation = CABasicAnimation(keyPath: "transform.translation.y") @@ -96,7 +96,7 @@ extension ProgressHUD { view.layer.addSublayer(circle) } - private func drawCircleWith(_ size: CGSize, _ color: UIColor) -> CALayer { + private func drawCircleWith(_ size: CGSize) -> CALayer { let path = UIBezierPath() let radius = size.width / 4 let center = CGPoint(x: size.width / 2, y: size.height / 2) @@ -104,7 +104,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.fillColor = nil - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = size.width / 2 layer.backgroundColor = nil layer.path = path.cgPath diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+BarSweepToggle.swift b/ProgressHUD/Sources/Animations/ProgressHUD+BarSweepToggle.swift index 710970d..851be4f 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+BarSweepToggle.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+BarSweepToggle.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Bar Sweep Toggle extension ProgressHUD { - func animationBarSweepToggle(_ view: UIView, _ color: UIColor) { + func animationBarSweepToggle(_ view: UIView) { let height = view.frame.size.height let width = view.frame.size.width @@ -29,7 +29,7 @@ extension ProgressHUD { let layerBar = CAShapeLayer() layerBar.path = pathBar.cgPath - layerBar.strokeColor = color.cgColor + layerBar.strokeColor = colorAnimation.cgColor layerBar.lineWidth = heightBar layerBar.lineCap = .round view.layer.addSublayer(layerBar) @@ -65,11 +65,11 @@ extension ProgressHUD { layerBar.add(animationPosition, forKey: "position") let frame = CGRect(x: -border, y: (height - heightBar) / 2 - border, width: width + 2 * border, height: heightBar + 2 * border) - let pathBorder = UIBezierPath(roundedRect: frame, cornerRadius: height) + let layerBorder = CAShapeLayer() layerBorder.path = pathBorder.cgPath - layerBorder.strokeColor = color.cgColor + layerBorder.strokeColor = colorAnimation.cgColor layerBorder.fillColor = UIColor.clear.cgColor layerBorder.lineWidth = border view.layer.addSublayer(layerBorder) diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CircleArcDotSpin.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CircleArcDotSpin.swift index c5f900e..b8b01d7 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CircleArcDotSpin.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CircleArcDotSpin.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Arc Dot Spin extension ProgressHUD { - func animationCircleArcDotSpin(_ view: UIView, _ color: UIColor) { + func animationCircleArcDotSpin(_ view: UIView) { let space = view.frame.width / 8 let x = view.bounds.minX + space / 2 let y = view.bounds.minY + space / 2 @@ -35,7 +35,7 @@ extension ProgressHUD { let y = center.y + radius * sin(angle) let circle = UIView(frame: CGRect(x: x - size / 2, y: y - size / 2, width: size, height: size)) - circle.backgroundColor = color + circle.backgroundColor = colorAnimation circle.layer.cornerRadius = size / 2 containerView.addSubview(circle) @@ -47,10 +47,10 @@ extension ProgressHUD { circle.layer.add(animation, forKey: "circleAnimation") } - animateArcRotation(containerView, color) + animateArcRotation(containerView) } - private func animateArcRotation(_ view: UIView, _ color: UIColor) { + private func animateArcRotation(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height let center = CGPoint(x: width / 2, y: height / 2) @@ -80,7 +80,7 @@ extension ProgressHUD { layer.frame = CGRect(x: 0, y: 0, width: width, height: height) layer.path = path.cgPath layer.fillColor = nil - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = view.frame.width / 6 layer.lineCap = .round diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CircleBarSpinFade.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CircleBarSpinFade.swift index b2d60fe..1a13642 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CircleBarSpinFade.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CircleBarSpinFade.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Bar Spin Fade extension ProgressHUD { - func animationCircleBarSpinFade(_ view: UIView, _ color: UIColor) { + func animationCircleBarSpinFade(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height @@ -43,15 +43,19 @@ extension ProgressHUD { let angle = .pi / 4 * CGFloat(i) let line = CAShapeLayer() - line.frame = CGRect(x: (containerSize - lineWidth) / 2, y: (containerSize - lineHeight) / 2, width: lineWidth, height: lineHeight) + let lineX = (containerSize - lineWidth) / 2 + let lineY = (containerSize - lineHeight) / 2 + line.frame = CGRect(x: lineX, y: lineY, width: lineWidth, height: lineHeight) line.path = path.cgPath line.backgroundColor = nil - line.fillColor = color.cgColor + line.fillColor = colorAnimation.cgColor let container = CALayer() - container.frame = CGRect(x: radius * (cos(angle) + 1), y: radius * (sin(angle) + 1), width: containerSize, height: containerSize) - container.addSublayer(line) + let containerX = radius * (cos(angle) + 1) + let containerY = radius * (sin(angle) + 1) + container.frame = CGRect(x: containerX, y: containerY, width: containerSize, height: containerSize) container.sublayerTransform = CATransform3DMakeRotation(.pi / 2 + angle, 0, 0, 1) + container.addSublayer(line) animation.beginTime = beginTime - beginTimes[i] diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CircleDotSpinFade.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CircleDotSpinFade.swift index 2775cdf..74d9ce5 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CircleDotSpinFade.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CircleDotSpinFade.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Dot Spin Fade extension ProgressHUD { - func animationCircleDotSpinFade(_ view: UIView, _ color: UIColor) { + func animationCircleDotSpinFade(_ view: UIView) { let width = view.frame.size.width let spacing = 3.0 @@ -50,7 +50,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.path = path.cgPath - layer.fillColor = color.cgColor + layer.fillColor = colorAnimation.cgColor layer.backgroundColor = nil layer.frame = CGRect(x: radiusX * (cos(angle) + 1), y: radiusX * (sin(angle) + 1), width: radius, height: radius) diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseMultiple.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseMultiple.swift index 611adb1..5a46949 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseMultiple.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseMultiple.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Pulse Multiple extension ProgressHUD { - func animationCirclePulseMultiple(_ view: UIView, _ color: UIColor) { + func animationCirclePulseMultiple(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height let center = CGPoint(x: width / 2, y: height / 2) @@ -47,7 +47,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.frame = CGRect(x: 0, y: 0, width: width, height: height) layer.path = path.cgPath - layer.fillColor = color.cgColor + layer.fillColor = colorAnimation.cgColor layer.opacity = 0 animation.beginTime = beginTime + beginTimes[i] diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseSingle.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseSingle.swift index ee031c0..4adb9ea 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseSingle.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CirclePulseSingle.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Pulse Single extension ProgressHUD { - func animationCirclePulseSingle(_ view: UIView, _ color: UIColor) { + func animationCirclePulseSingle(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height let center = CGPoint(x: width / 2, y: height / 2) @@ -44,7 +44,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.frame = CGRect(x: 0, y: 0, width: width, height: height) layer.path = path.cgPath - layer.fillColor = color.cgColor + layer.fillColor = colorAnimation.cgColor layer.add(animation, forKey: "animation") view.layer.addSublayer(layer) diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CircleRippleMultiple.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CircleRippleMultiple.swift index 8b649f2..998f105 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CircleRippleMultiple.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CircleRippleMultiple.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Ripple Multiple extension ProgressHUD { - func animationCircleRippleMultiple(_ view: UIView, _ color: UIColor) { + func animationCircleRippleMultiple(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height let center = CGPoint(x: width / 2, y: height / 2) @@ -50,7 +50,7 @@ extension ProgressHUD { layer.frame = CGRect(x: 0, y: 0, width: width, height: height) layer.path = path.cgPath layer.backgroundColor = nil - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = 3 layer.fillColor = nil diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CircleRippleSingle.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CircleRippleSingle.swift index 32dd74e..c9c2276 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CircleRippleSingle.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CircleRippleSingle.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Ripple Single extension ProgressHUD { - func animationCircleRippleSingle(_ view: UIView, _ color: UIColor) { + func animationCircleRippleSingle(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height let center = CGPoint(x: width / 2, y: height / 2) @@ -48,7 +48,7 @@ extension ProgressHUD { layer.path = path.cgPath layer.backgroundColor = nil layer.fillColor = nil - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = 3 layer.add(animation, forKey: "animation") diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CircleRotateChase.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CircleRotateChase.swift index 6c9744b..db573ef 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CircleRotateChase.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CircleRotateChase.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Rotate Chase extension ProgressHUD { - func animationCircleRotateChase(_ view: UIView, _ color: UIColor) { + func animationCircleRotateChase(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height let center1 = CGPoint(x: width / 2, y: height / 2) @@ -55,7 +55,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.frame = CGRect(x: 0, y: 0, width: radius, height: radius) layer.path = path2.cgPath - layer.fillColor = color.cgColor + layer.fillColor = colorAnimation.cgColor layer.add(animation, forKey: "animation") view.layer.addSublayer(layer) diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+CircleStrokeSpin.swift b/ProgressHUD/Sources/Animations/ProgressHUD+CircleStrokeSpin.swift index 1040f6a..3bf0220 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+CircleStrokeSpin.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+CircleStrokeSpin.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Circle Stroke Spin extension ProgressHUD { - func animationCircleStrokeSpin(_ view: UIView, _ color: UIColor) { + func animationCircleStrokeSpin(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height let center = CGPoint(x: width / 2, y: height / 2) @@ -53,7 +53,7 @@ extension ProgressHUD { layer.frame = CGRect(x: 0, y: 0, width: width, height: height) layer.path = path.cgPath layer.fillColor = nil - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = 3 layer.add(animation, forKey: "animation") diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+DualDotSidestep.swift b/ProgressHUD/Sources/Animations/ProgressHUD+DualDotSidestep.swift index cfdd61c..b79cab9 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+DualDotSidestep.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+DualDotSidestep.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Dual Dot Sidestep extension ProgressHUD { - func animationDualDotSidestep(_ view: UIView, _ color: UIColor) { + func animationDualDotSidestep(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height let radius = width / 4 @@ -22,30 +22,30 @@ extension ProgressHUD { let startX = radius let lineWidth = 3.0 - let hollowCircle = createCircleLayer(CGPoint(x: startX, y: startY), radius - lineWidth / 2, color, false, view, lineWidth) + let hollowCircle = createCircleLayer(CGPoint(x: startX, y: startY), radius - lineWidth / 2, false, view, lineWidth) - let filledCircle = createCircleLayer(CGPoint(x: width - startX, y: startY), radius, color, true, view, lineWidth) + let filledCircle = createCircleLayer(CGPoint(x: width - startX, y: startY), radius, true, view, lineWidth) - let animationGroup1 = moveAnimationGroup(targetValue: width - radius * 2) + let animationGroup1 = moveAnimationGroup(width - radius * 2) hollowCircle.add(animationGroup1, forKey: "animation") - let animationGroup2 = moveAnimationGroup(targetValue: -(width - radius * 2)) + let animationGroup2 = moveAnimationGroup(-(width - radius * 2)) filledCircle.add(animationGroup2, forKey: "animation") - let zPositionAnimation1 = createZPositionAnimation(fromValue: 0, toValue: 1) + let zPositionAnimation1 = createZPositionAnimation(0, 1) hollowCircle.add(zPositionAnimation1, forKey: "zPositionAnimation") - let zPositionAnimation2 = createZPositionAnimation(fromValue: 1, toValue: 0) + let zPositionAnimation2 = createZPositionAnimation(1, 0) filledCircle.add(zPositionAnimation2, forKey: "zPositionAnimation") } - private func createCircleLayer(_ center: CGPoint, _ radius: CGFloat, _ color: UIColor, _ filled: Bool, _ view: UIView, _ lineWidth: Double) -> CAShapeLayer { + private func createCircleLayer(_ center: CGPoint, _ radius: CGFloat, _ filled: Bool, _ view: UIView, _ lineWidth: Double) -> CAShapeLayer { let path = UIBezierPath(arcCenter: center, radius: radius, startAngle: 0, endAngle: 2 * .pi, clockwise: true) let layer = CAShapeLayer() layer.path = path.cgPath - layer.strokeColor = filled ? UIColor.clear.cgColor : color.cgColor - layer.fillColor = filled ? color.cgColor : UIColor.clear.cgColor + layer.strokeColor = filled ? UIColor.clear.cgColor : colorAnimation.cgColor + layer.fillColor = filled ? colorAnimation.cgColor : UIColor.clear.cgColor layer.lineWidth = filled ? 0.0 : lineWidth layer.zPosition = filled ? 1.0 : 0.0 view.layer.addSublayer(layer) @@ -53,7 +53,7 @@ extension ProgressHUD { return layer } - private func createZPositionAnimation(fromValue: CGFloat, toValue: CGFloat) -> CAKeyframeAnimation { + private func createZPositionAnimation(_ fromValue: CGFloat, _ toValue: CGFloat) -> CAKeyframeAnimation { let animation = CAKeyframeAnimation(keyPath: "zPosition") animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animation.values = [fromValue, toValue] @@ -63,11 +63,11 @@ extension ProgressHUD { return animation } - private func moveAnimationGroup(targetValue: CGFloat) -> CAAnimationGroup { + private func moveAnimationGroup(_ toValue: CGFloat) -> CAAnimationGroup { let animation = CABasicAnimation(keyPath: "position.x") animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animation.fromValue = 0 - animation.toValue = targetValue + animation.toValue = toValue animation.duration = 1.0 animation.autoreverses = true diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+HorizontalBarScaling.swift b/ProgressHUD/Sources/Animations/ProgressHUD+HorizontalBarScaling.swift index 76dd4cb..cb207e2 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+HorizontalBarScaling.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+HorizontalBarScaling.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Horizontal Bar Scaling extension ProgressHUD { - func animationHorizontalBarScaling(_ view: UIView, _ color: UIColor) { + func animationHorizontalBarScaling(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height @@ -39,7 +39,7 @@ extension ProgressHUD { layer.frame = CGRect(x: lineWidth * 2 * CGFloat(i), y: 0, width: lineWidth, height: height) layer.path = path.cgPath layer.backgroundColor = nil - layer.fillColor = color.cgColor + layer.fillColor = colorAnimation.cgColor animation.beginTime = beginTime - beginTimes[i] diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+HorizontalDotScaling.swift b/ProgressHUD/Sources/Animations/ProgressHUD+HorizontalDotScaling.swift index 81e3faf..5fa8297 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+HorizontalDotScaling.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+HorizontalDotScaling.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Horizontal Dot Scaling extension ProgressHUD { - func animationHorizontalDotScaling(_ view: UIView, _ color: UIColor) { + func animationHorizontalDotScaling(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height @@ -41,7 +41,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.frame = CGRect(x: (radius + spacing) * CGFloat(i), y: positionY, width: radius, height: radius) layer.path = path.cgPath - layer.fillColor = color.cgColor + layer.fillColor = colorAnimation.cgColor animation.beginTime = beginTime - beginTimes[i] diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+PacmanProgress.swift b/ProgressHUD/Sources/Animations/ProgressHUD+PacmanProgress.swift index bd5ef90..5965568 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+PacmanProgress.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+PacmanProgress.swift @@ -14,18 +14,18 @@ import UIKit // MARK: - Pacman Progress extension ProgressHUD { - func animationPacmanProgress(_ view: UIView, _ color: UIColor) { - createPacman(view, color) - createCircle(view, color) + func animationPacmanProgress(_ view: UIView) { + createPacman(view) + createCircle(view) } - private func createPacman(_ view: UIView, _ color: UIColor) { + private func createPacman(_ view: UIView) { let width = view.frame.size.width let size = width / 1.5 let duration = 0.7 let timingFunction = CAMediaTimingFunction(name: .default) - let pacman = drawWith(size: CGSize(width: size, height: size), color: color) + let pacman = drawWith(CGSize(width: size, height: size)) let x = (view.layer.bounds.size.width - width) / 2 let y = (view.layer.bounds.size.height - size) / 2 pacman.frame = CGRect(x: x, y: y, width: size, height: size) @@ -52,11 +52,11 @@ extension ProgressHUD { view.layer.addSublayer(pacman) } - private func createCircle(_ view: UIView, _ color: UIColor) { + private func createCircle(_ view: UIView) { let width = view.frame.size.width let size = width / 6 - let circle = drawWith(size: CGSize(width: size, height: size), color: color) + let circle = drawWith(CGSize(width: size, height: size)) let x = (view.layer.bounds.size.width - width) / 2 + width - size let y = (view.layer.bounds.size.height - size) / 2 circle.frame = CGRect(x: x, y: y, width: size, height: size) @@ -76,14 +76,14 @@ extension ProgressHUD { view.layer.addSublayer(circle) } - private func drawWith(size: CGSize, color: UIColor) -> CALayer { + private func drawWith(_ size: CGSize) -> CALayer { let layer = CAShapeLayer() let path = UIBezierPath() let center = CGPoint(x: size.width / 2, y: size.height / 2) path.addArc(withCenter: center, radius: size.width / 4, startAngle: 0, endAngle: CGFloat(2 * Double.pi), clockwise: true) layer.fillColor = nil - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = size.width / 2 layer.backgroundColor = nil diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+QuintupleDotDance.swift b/ProgressHUD/Sources/Animations/ProgressHUD+QuintupleDotDance.swift index 98406a8..bbcd2f1 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+QuintupleDotDance.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+QuintupleDotDance.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Quintuple Dot Dance extension ProgressHUD { - func animationQuintupleDotDance(_ view: UIView, _ color: UIColor) { + func animationQuintupleDotDance(_ view: UIView) { let height = view.frame.size.height let width = view.frame.size.width let radius = width / 20 @@ -36,25 +36,25 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.path = path.cgPath layer.fillColor = UIColor.clear.cgColor - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = stroke view.layer.addSublayer(layer) let animationGroup: CAAnimationGroup if i == 0 { - let targetValue = startX + (circleWidth*numberOfCircles) + circleSpacing * 2 - animationGroup = createHorizontalAnimationGroup(targetValue: targetValue) + let toValue = startX + (circleWidth*numberOfCircles) + circleSpacing * 2 + animationGroup = createHorizontalAnimationGroup(toValue) } else if (i % 2 == 1) { - animationGroup = createUpDownAnimationGroup(toValue: -height / 3) + animationGroup = createUpDownAnimationGroup(-height / 3) } else { - animationGroup = createUpDownAnimationGroup(toValue: height / 3) + animationGroup = createUpDownAnimationGroup(height / 3) } layer.add(animationGroup, forKey: "animation") } } - private func createUpDownAnimationGroup(toValue: CGFloat) -> CAAnimationGroup { + private func createUpDownAnimationGroup(_ toValue: CGFloat) -> CAAnimationGroup { let animation = CABasicAnimation(keyPath: "position.y") animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animation.autoreverses = true @@ -70,12 +70,12 @@ extension ProgressHUD { return animationGroup } - private func createHorizontalAnimationGroup(targetValue: CGFloat) -> CAAnimationGroup { + private func createHorizontalAnimationGroup(_ toValue: CGFloat) -> CAAnimationGroup { let animation = CABasicAnimation(keyPath: "position.x") animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animation.autoreverses = true animation.fromValue = 0 - animation.toValue = targetValue + animation.toValue = toValue animation.duration = 1.0 let animationGroup = CAAnimationGroup() diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+SFSymbolBounce.swift b/ProgressHUD/Sources/Animations/ProgressHUD+SFSymbolBounce.swift new file mode 100644 index 0000000..e26d511 --- /dev/null +++ b/ProgressHUD/Sources/Animations/ProgressHUD+SFSymbolBounce.swift @@ -0,0 +1,35 @@ +// +// Copyright (c) 2023 Related Code - https://relatedcode.com +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import UIKit + +// MARK: - SF Symbol Bounce +extension ProgressHUD { + + func animationSFSymbolBounce(_ view: UIView) { + let width = view.frame.width + let height = view.frame.height + + let image = UIImage(systemName: animationSymbol) ?? UIImage(systemName: "questionmark") + + let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: width, height: height)) + let configuration = UIImage.SymbolConfiguration(weight: .bold) + imageView.image = image?.applyingSymbolConfiguration(configuration) + imageView.tintColor = colorAnimation + imageView.contentMode = .scaleAspectFit + + if #available(iOS 17.0, *) { + imageView.addSymbolEffect(.bounce, options: .repeating) + } + + view.addSubview(imageView) + } +} diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+SemiRingRotation.swift b/ProgressHUD/Sources/Animations/ProgressHUD+SemiRingRotation.swift index 15c1992..14b1a76 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+SemiRingRotation.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+SemiRingRotation.swift @@ -14,27 +14,27 @@ import UIKit // MARK: - Semi-Ring Rotation extension ProgressHUD { - func animationSemiRingRotation(_ view: UIView, _ color: UIColor) { + func animationSemiRingRotation(_ view: UIView) { let width = view.frame.size.width let sizeLarge = width let sizeSmall = width / 2 let duration = 1.6 - drawCircleOf(.twoHalfRingsVertical, duration, view.layer, sizeSmall, color, true) - drawCircleOf(.twoHalfRingsHorizontal, duration, view.layer, sizeLarge, color, false) + drawCircleOf(.twoHalfRingsVertical, duration, view.layer, sizeSmall, true) + drawCircleOf(.twoHalfRingsHorizontal, duration, view.layer, sizeLarge, false) } - private func drawCircleOf(_ shape: ShapeType, _ duration: CFTimeInterval, _ layer: CALayer, _ size: CGFloat, _ color: UIColor, _ reverse: Bool) { - let circle = shape.layerWith(size: CGSize(width: size, height: size), color: color) - let frame = CGRect(x: (layer.bounds.size.width - size) / 2, y: (layer.bounds.size.height - size) / 2, width: size, height: size) - let animation = createAnimationIn(duration: duration, reverse: reverse) - - circle.frame = frame + private func drawCircleOf(_ shape: ShapeType, _ duration: CFTimeInterval, _ layer: CALayer, _ size: CGFloat, _ reverse: Bool) { + let animation = createAnimation(duration, reverse) + let circle = shape.layerWith(CGSize(width: size, height: size)) + let x = (layer.bounds.size.width - size) / 2 + let y = (layer.bounds.size.height - size) / 2 + circle.frame = CGRect(x: x, y: y, width: size, height: size) circle.add(animation, forKey: "animation") layer.addSublayer(circle) } - private func createAnimationIn(duration: CFTimeInterval, reverse: Bool) -> CAAnimation { + private func createAnimation(_ duration: CFTimeInterval, _ reverse: Bool) -> CAAnimation { let timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) let animationScale = CAKeyframeAnimation(keyPath: "transform.scale") @@ -60,7 +60,7 @@ extension ProgressHUD { case twoHalfRingsVertical case twoHalfRingsHorizontal - func layerWith(size: CGSize, color: UIColor) -> CALayer { + func layerWith(_ size: CGSize) -> CALayer { let width = size.width let height = size.height @@ -71,7 +71,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.lineWidth = 6.0 layer.fillColor = nil - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.backgroundColor = nil layer.lineCap = .round layer.frame = CGRect(x: 0, y: 0, width: width, height: height) diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+SquareCircuitSnake.swift b/ProgressHUD/Sources/Animations/ProgressHUD+SquareCircuitSnake.swift index bfb4632..a02374f 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+SquareCircuitSnake.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+SquareCircuitSnake.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Square Circuit Snake extension ProgressHUD { - func animationSquareCircuitSnake(_ view: UIView, _ color: UIColor) { + func animationSquareCircuitSnake(_ view: UIView) { let space = view.frame.width / 6 let x = view.bounds.minX + space / 2 let y = view.bounds.minY + space / 2 @@ -23,10 +23,10 @@ extension ProgressHUD { let containerView = UIView(frame: CGRect(x: x, y: y, width: width, height: height)) view.addSubview(containerView) - squareLoadingAnimation(containerView, color) + squareLoadingAnimation(containerView) } - private func squareLoadingAnimation(_ view: UIView, _ color: UIColor) { + private func squareLoadingAnimation(_ view: UIView) { let width = view.frame.size.width let height = view.frame.size.height @@ -65,21 +65,21 @@ extension ProgressHUD { let rect = CGRect(x: 0, y: 0, width: width, height: height) - let layerMove = createShapeLayer(frame: rect, path: path.cgPath, color: color) + let layerMove = createShapeLayer(rect, path, colorAnimation) layerMove.add(animationGroup, forKey: "animation") view.layer.addSublayer(layerMove) - let layerBase = createShapeLayer(frame: rect, path: path.cgPath, color: color.withAlphaComponent(0.3)) + let layerBase = createShapeLayer(rect, path, colorAnimation.withAlphaComponent(0.3)) view.layer.addSublayer(layerBase) } - private func createShapeLayer(frame: CGRect, path: CGPath, color: UIColor) -> CAShapeLayer { + private func createShapeLayer(_ rect: CGRect, _ path: UIBezierPath, _ color: UIColor) -> CAShapeLayer { let layer = CAShapeLayer() - layer.frame = frame - layer.path = path + layer.frame = rect + layer.path = path.cgPath layer.fillColor = nil layer.strokeColor = color.cgColor - layer.lineWidth = frame.width / 6 + layer.lineWidth = rect.width / 6 layer.lineCap = .round return layer } diff --git a/ProgressHUD/Sources/Animations/ProgressHUD+TriangleDotShift.swift b/ProgressHUD/Sources/Animations/ProgressHUD+TriangleDotShift.swift index 7a22f9a..509dd30 100644 --- a/ProgressHUD/Sources/Animations/ProgressHUD+TriangleDotShift.swift +++ b/ProgressHUD/Sources/Animations/ProgressHUD+TriangleDotShift.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Triangle Dot Shift extension ProgressHUD { - func animationTriangleDotShift(_ view: UIView, _ color: UIColor) { + func animationTriangleDotShift(_ view: UIView) { let height = view.frame.size.height let width = view.frame.size.width let radius = width / 5 @@ -34,27 +34,27 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.path = path.cgPath - layer.fillColor = color.cgColor + layer.fillColor = colorAnimation.cgColor view.layer.addSublayer(layer) let animationGroup: CAAnimationGroup if i == 0 { - animationGroup = moveRightAnimationGroup(targetValue: width - radius * 2) + animationGroup = moveRightAnimationGroup(width - radius * 2) } else if i == 1 { - animationGroup = moveBottomAnimationGroup(targetValue: width - radius * 2) + animationGroup = moveBottomAnimationGroup(width - radius * 2) } else { - animationGroup = moveUpAnimationGroup(targetValue: width - radius * 2) + animationGroup = moveUpAnimationGroup(width - radius * 2) } layer.add(animationGroup, forKey: "animation") } } - private func moveRightAnimationGroup(targetValue: CGFloat) -> CAAnimationGroup { + private func moveRightAnimationGroup(_ toValue: CGFloat) -> CAAnimationGroup { let animation = CABasicAnimation(keyPath: "position.x") animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animation.fromValue = 0 - animation.toValue = targetValue + animation.toValue = toValue animation.duration = 0.6 let animationGroup = CAAnimationGroup() @@ -65,17 +65,17 @@ extension ProgressHUD { return animationGroup } - private func moveBottomAnimationGroup(targetValue: CGFloat) -> CAAnimationGroup { + private func moveBottomAnimationGroup(_ toValue: CGFloat) -> CAAnimationGroup { let animationX = CABasicAnimation(keyPath: "position.y") animationX.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animationX.fromValue = 0 - animationX.toValue = targetValue + animationX.toValue = toValue animationX.duration = 0.6 let animationY = CABasicAnimation(keyPath: "position.x") animationY.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animationY.fromValue = 0 - animationY.toValue = -targetValue / 2 + animationY.toValue = -toValue / 2 animationY.duration = 0.6 let animationGroup = CAAnimationGroup() @@ -86,17 +86,17 @@ extension ProgressHUD { return animationGroup } - private func moveUpAnimationGroup(targetValue: CGFloat) -> CAAnimationGroup { + private func moveUpAnimationGroup(_ toValue: CGFloat) -> CAAnimationGroup { let animationX = CABasicAnimation(keyPath: "position.y") animationX.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animationX.fromValue = 0 - animationX.toValue = -targetValue + animationX.toValue = -toValue animationX.duration = 0.6 let animationY = CABasicAnimation(keyPath: "position.x") animationY.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animationY.fromValue = 0 - animationY.toValue = -targetValue / 2 + animationY.toValue = -toValue / 2 animationY.duration = 0.6 let animationGroup = CAAnimationGroup() diff --git a/ProgressHUD/Sources/ProgressHUD+AnimatedIcon.swift b/ProgressHUD/Sources/ProgressHUD+AnimatedIcon.swift index 8f4ae21..e722033 100644 --- a/ProgressHUD/Sources/ProgressHUD+AnimatedIcon.swift +++ b/ProgressHUD/Sources/ProgressHUD+AnimatedIcon.swift @@ -14,7 +14,7 @@ import UIKit // MARK: - Succeed extension ProgressHUD { - func animatedIconSucceed(_ view: UIView, _ color: UIColor) { + func animatedIconSucceed(_ view: UIView) { let length = view.frame.width let delay = (alpha == 0) ? 0.25 : 0.0 @@ -34,7 +34,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.path = path.cgPath layer.fillColor = UIColor.clear.cgColor - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = 9 layer.lineCap = .round layer.lineJoin = .round @@ -48,7 +48,7 @@ extension ProgressHUD { // MARK: - Failed extension ProgressHUD { - func animatedIconFailed(_ view: UIView, _ color: UIColor) { + func animatedIconFailed(_ view: UIView) { let length = view.frame.width let delay = (alpha == 0) ? 0.25 : 0.0 @@ -74,7 +74,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.path = paths[i].cgPath layer.fillColor = UIColor.clear.cgColor - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = 9 layer.lineCap = .round layer.lineJoin = .round @@ -91,7 +91,7 @@ extension ProgressHUD { // MARK: - Added extension ProgressHUD { - func animatedIconAdded(_ view: UIView, _ color: UIColor) { + func animatedIconAdded(_ view: UIView) { let length = view.frame.width let delay = (alpha == 0) ? 0.25 : 0.0 @@ -117,7 +117,7 @@ extension ProgressHUD { let layer = CAShapeLayer() layer.path = paths[i].cgPath layer.fillColor = UIColor.clear.cgColor - layer.strokeColor = color.cgColor + layer.strokeColor = colorAnimation.cgColor layer.lineWidth = 9 layer.lineCap = .round layer.lineJoin = .round diff --git a/ProgressHUD/Sources/ProgressHUD+Enums.swift b/ProgressHUD/Sources/ProgressHUD+Enums.swift index 1a3c487..0eefe80 100644 --- a/ProgressHUD/Sources/ProgressHUD+Enums.swift +++ b/ProgressHUD/Sources/ProgressHUD+Enums.swift @@ -32,6 +32,7 @@ public enum AnimationType: CaseIterable { case pacmanProgress case quintupleDotDance case semiRingRotation + case sfSymbolBounce case squareCircuitSnake case triangleDotShift } diff --git a/ProgressHUD/Sources/ProgressHUD+Public.swift b/ProgressHUD/Sources/ProgressHUD+Public.swift index b432d8a..a183275 100644 --- a/ProgressHUD/Sources/ProgressHUD+Public.swift +++ b/ProgressHUD/Sources/ProgressHUD+Public.swift @@ -63,6 +63,11 @@ public extension ProgressHUD { set { shared.animationType = newValue } } + class var animationSymbol: String { + get { shared.animationSymbol } + set { shared.animationSymbol = newValue } + } + class var colorBackground: UIColor { get { shared.colorBackground } set { shared.colorBackground = newValue } diff --git a/ProgressHUD/Sources/ProgressHUD.swift b/ProgressHUD/Sources/ProgressHUD.swift index edd5772..af60eb1 100644 --- a/ProgressHUD/Sources/ProgressHUD.swift +++ b/ProgressHUD/Sources/ProgressHUD.swift @@ -47,6 +47,7 @@ public class ProgressHUD: UIView { var viewAnimation: UIView? var animationType = AnimationType.activityIndicator + var animationSymbol = "sun.max" var colorBackground = UIColor(red: 0, green: 0, blue: 0, alpha: 0.2) var colorHUD = UIColor.systemGray @@ -293,9 +294,9 @@ extension ProgressHUD { $0.removeFromSuperlayer() } - if (animatedIcon == .succeed) { animatedIconSucceed(viewAnimatedIcon, colorAnimation) } - if (animatedIcon == .failed) { animatedIconFailed(viewAnimatedIcon, colorAnimation) } - if (animatedIcon == .added) { animatedIconAdded(viewAnimatedIcon, colorAnimation) } + if (animatedIcon == .succeed) { animatedIconSucceed(viewAnimatedIcon) } + if (animatedIcon == .failed) { animatedIconFailed(viewAnimatedIcon) } + if (animatedIcon == .added) { animatedIconAdded(viewAnimatedIcon) } } } @@ -350,26 +351,27 @@ extension ProgressHUD { $0.removeFromSuperlayer() } - if (animationType == .activityIndicator) { animationActivityIndicator(viewAnimation, colorAnimation) } - if (animationType == .ballVerticalBounce) { animationBallVerticalBounce(viewAnimation, colorAnimation) } - if (animationType == .barSweepToggle) { animationBarSweepToggle(viewAnimation, colorAnimation) } - if (animationType == .circleArcDotSpin) { animationCircleArcDotSpin(viewAnimation, colorAnimation) } - if (animationType == .circleBarSpinFade) { animationCircleBarSpinFade(viewAnimation, colorAnimation) } - if (animationType == .circleDotSpinFade) { animationCircleDotSpinFade(viewAnimation, colorAnimation) } - if (animationType == .circlePulseMultiple) { animationCirclePulseMultiple(viewAnimation, colorAnimation) } - if (animationType == .circlePulseSingle) { animationCirclePulseSingle(viewAnimation, colorAnimation) } - if (animationType == .circleRippleMultiple) { animationCircleRippleMultiple(viewAnimation, colorAnimation) } - if (animationType == .circleRippleSingle) { animationCircleRippleSingle(viewAnimation, colorAnimation) } - if (animationType == .circleRotateChase) { animationCircleRotateChase(viewAnimation, colorAnimation) } - if (animationType == .circleStrokeSpin) { animationCircleStrokeSpin(viewAnimation, colorAnimation) } - if (animationType == .dualDotSidestep) { animationDualDotSidestep(viewAnimation, colorAnimation) } - if (animationType == .horizontalBarScaling) { animationHorizontalBarScaling(viewAnimation, colorAnimation) } - if (animationType == .horizontalDotScaling) { animationHorizontalDotScaling(viewAnimation, colorAnimation) } - if (animationType == .pacmanProgress) { animationPacmanProgress(viewAnimation, colorAnimation) } - if (animationType == .quintupleDotDance) { animationQuintupleDotDance(viewAnimation, colorAnimation) } - if (animationType == .semiRingRotation) { animationSemiRingRotation(viewAnimation, colorAnimation) } - if (animationType == .squareCircuitSnake) { animationSquareCircuitSnake(viewAnimation, colorAnimation) } - if (animationType == .triangleDotShift) { animationTriangleDotShift(viewAnimation, colorAnimation) } + if (animationType == .activityIndicator) { animationActivityIndicator(viewAnimation) } + if (animationType == .ballVerticalBounce) { animationBallVerticalBounce(viewAnimation) } + if (animationType == .barSweepToggle) { animationBarSweepToggle(viewAnimation) } + if (animationType == .circleArcDotSpin) { animationCircleArcDotSpin(viewAnimation) } + if (animationType == .circleBarSpinFade) { animationCircleBarSpinFade(viewAnimation) } + if (animationType == .circleDotSpinFade) { animationCircleDotSpinFade(viewAnimation) } + if (animationType == .circlePulseMultiple) { animationCirclePulseMultiple(viewAnimation) } + if (animationType == .circlePulseSingle) { animationCirclePulseSingle(viewAnimation) } + if (animationType == .circleRippleMultiple) { animationCircleRippleMultiple(viewAnimation) } + if (animationType == .circleRippleSingle) { animationCircleRippleSingle(viewAnimation) } + if (animationType == .circleRotateChase) { animationCircleRotateChase(viewAnimation) } + if (animationType == .circleStrokeSpin) { animationCircleStrokeSpin(viewAnimation) } + if (animationType == .dualDotSidestep) { animationDualDotSidestep(viewAnimation) } + if (animationType == .horizontalBarScaling) { animationHorizontalBarScaling(viewAnimation) } + if (animationType == .horizontalDotScaling) { animationHorizontalDotScaling(viewAnimation) } + if (animationType == .pacmanProgress) { animationPacmanProgress(viewAnimation) } + if (animationType == .quintupleDotDance) { animationQuintupleDotDance(viewAnimation) } + if (animationType == .semiRingRotation) { animationSemiRingRotation(viewAnimation) } + if (animationType == .sfSymbolBounce) { animationSFSymbolBounce(viewAnimation) } + if (animationType == .squareCircuitSnake) { animationSquareCircuitSnake(viewAnimation) } + if (animationType == .triangleDotShift) { animationTriangleDotShift(viewAnimation) } } } diff --git a/ProgressHUD/app.xcodeproj/project.pbxproj b/ProgressHUD/app.xcodeproj/project.pbxproj index d5c5f2e..8abbf75 100644 --- a/ProgressHUD/app.xcodeproj/project.pbxproj +++ b/ProgressHUD/app.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 29D29F011D9A59E4006CA074 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 29D29F001D9A59E4006CA074 /* Assets.xcassets */; }; 29D29F041D9A59E4006CA074 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 29D29F021D9A59E4006CA074 /* LaunchScreen.storyboard */; }; 29D99E7E2AC4A3300073EE38 /* NavController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29D99E7D2AC4A3300073EE38 /* NavController.swift */; }; + 29E576A12ADB05B200929F5B /* ProgressHUD+SFSymbolBounce.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29E576A02ADB05B100929F5B /* ProgressHUD+SFSymbolBounce.swift */; }; 29FD93C82AD9781A0054B585 /* ProgressHUD+BarSweepToggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29FD93B42AD9781A0054B585 /* ProgressHUD+BarSweepToggle.swift */; }; 29FD93C92AD9781A0054B585 /* ProgressHUD+DualDotSidestep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29FD93B52AD9781A0054B585 /* ProgressHUD+DualDotSidestep.swift */; }; 29FD93CA2AD9781A0054B585 /* ProgressHUD+QuintupleDotDance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29FD93B62AD9781A0054B585 /* ProgressHUD+QuintupleDotDance.swift */; }; @@ -56,6 +57,7 @@ 29D29F031D9A59E4006CA074 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29D29F051D9A59E4006CA074 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29D99E7D2AC4A3300073EE38 /* NavController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavController.swift; sourceTree = ""; }; + 29E576A02ADB05B100929F5B /* ProgressHUD+SFSymbolBounce.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ProgressHUD+SFSymbolBounce.swift"; sourceTree = ""; }; 29FD93B42AD9781A0054B585 /* ProgressHUD+BarSweepToggle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ProgressHUD+BarSweepToggle.swift"; sourceTree = ""; }; 29FD93B52AD9781A0054B585 /* ProgressHUD+DualDotSidestep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ProgressHUD+DualDotSidestep.swift"; sourceTree = ""; }; 29FD93B62AD9781A0054B585 /* ProgressHUD+QuintupleDotDance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ProgressHUD+QuintupleDotDance.swift"; sourceTree = ""; }; @@ -110,6 +112,7 @@ 29FD93B92AD9781A0054B585 /* ProgressHUD+PacmanProgress.swift */, 29FD93B62AD9781A0054B585 /* ProgressHUD+QuintupleDotDance.swift */, 29FD93BE2AD9781A0054B585 /* ProgressHUD+SemiRingRotation.swift */, + 29E576A02ADB05B100929F5B /* ProgressHUD+SFSymbolBounce.swift */, 29FD93C02AD9781A0054B585 /* ProgressHUD+SquareCircuitSnake.swift */, 29FD93C42AD9781A0054B585 /* ProgressHUD+TriangleDotShift.swift */, ); @@ -258,6 +261,7 @@ 29FD93C82AD9781A0054B585 /* ProgressHUD+BarSweepToggle.swift in Sources */, 29FD93CB2AD9781A0054B585 /* ProgressHUD+CirclePulseSingle.swift in Sources */, 299876DB248FCB290025E297 /* ProgressHUD.swift in Sources */, + 29E576A12ADB05B200929F5B /* ProgressHUD+SFSymbolBounce.swift in Sources */, 29A3BDB52AC6AF780034CAF3 /* ProgressHUD+Public.swift in Sources */, 29FD93D52AD9781A0054B585 /* ProgressHUD+CircleRotateChase.swift in Sources */, 29FD93D42AD9781A0054B585 /* ProgressHUD+SquareCircuitSnake.swift in Sources */, @@ -421,7 +425,7 @@ INFOPLIST_FILE = app/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 13.8.6; + MARKETING_VERSION = 14.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.relatedcode.progresshud; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -452,7 +456,7 @@ INFOPLIST_FILE = app/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 13.8.6; + MARKETING_VERSION = 14.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.relatedcode.progresshud; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ProgressHUD/app/ViewController.swift b/ProgressHUD/app/ViewController.swift index 539b059..4f9340f 100644 --- a/ProgressHUD/app/ViewController.swift +++ b/ProgressHUD/app/ViewController.swift @@ -34,6 +34,7 @@ extension AnimationType { case .pacmanProgress: return "Pacman Progress" case .quintupleDotDance: return "Quintuple Dot Dance" case .semiRingRotation: return "Semi-Ring Rotation" + case .sfSymbolBounce: return "SF Symbol Bounce" case .squareCircuitSnake: return "Square Circuit Snake" case .triangleDotShift: return "Triangle Dot Shift" } @@ -220,7 +221,11 @@ extension ViewController { } if (indexPath.section == 2) { - ProgressHUD.animationType = animations[indexPath.row] + let animation = animations[indexPath.row] + ProgressHUD.animationType = animation + if (animation == .sfSymbolBounce) { + ProgressHUD.animationSymbol = symbol() + } ProgressHUD.show(status) } diff --git a/VERSION.txt b/VERSION.txt index 65ba4b0..4b964e9 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -13.8.6 +14.0.0