Skip to content

Commit

Permalink
Fixed coding style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shndrs committed Feb 7, 2021
1 parent 59f29b0 commit 85a613c
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 83 deletions.
20 changes: 9 additions & 11 deletions EZProgressHUD.podspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@

Pod::Spec.new do |spec|

spec.name = "EZProgressHUD"
spec.version = "1.5.3"
spec.summary = "A very cool and easy to use activity indicator for iOS Application ;) Hope you fellas enjoy it 😊😊"

spec.name = "EZProgressHUD"
spec.version = "1.5.4"
spec.summary = "A very cool and easy to use activity indicator for iOS Application ;) Hope you fellas enjoy it 😊😊"
spec.description = <<-DESC
As we said, this is a very cool and easy to use activity indicator for iOS and guess what!!?? Android Application(coming soon...)
hope you guys enjoy it. -shndrs -hnk
As we said, this is a very cool and easy to use activity indicator for iOS
hope you guys enjoy it. -shndrs
DESC

spec.homepage = "https://github.com/shndrs/EZProgressHUD"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.author = { "shndrs" => "[email protected]" }
spec.homepage = "https://github.com/shndrs/EZProgressHUD"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.author = { "shndrs" => "[email protected]" }

spec.ios.deployment_target = "9.3"
spec.swift_version = "5"


spec.source = { :git => "https://github.com/shndrs/EZProgressHUD.git", :tag => "#{spec.version}" }
spec.source = { :git => "https://github.com/shndrs/EZProgressHUD.git", :tag => "#{spec.version}" }

spec.source_files = "EZProgressHUD/**/*.{h,m,swift}"
spec.exclude_files = "Classes/Exclude"
Expand Down
2 changes: 2 additions & 0 deletions EZProgressHUD.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.5.4;
PRODUCT_BUNDLE_IDENTIFIER = shndrs.EZProgressHUD;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -677,6 +678,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.5.4;
PRODUCT_BUNDLE_IDENTIFIER = shndrs.EZProgressHUD;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
Binary file not shown.
3 changes: 3 additions & 0 deletions EZProgressHUD/EZAnimations/EZAnimationArgument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class BaseAnimationArgument {
self.duration = duration
self.option = option
}

}

public final class TransformArguments: BaseAnimationArgument {
Expand All @@ -32,6 +33,7 @@ public final class TransformArguments: BaseAnimationArgument {
self.toValue = toValue
super.init(duration: base.duration, option: base.option)
}

}

public final class LineDashPhaseArguments: BaseAnimationArgument {
Expand All @@ -46,4 +48,5 @@ public final class LineDashPhaseArguments: BaseAnimationArgument {
self.autoreverse = autoreverse
super.init(duration: base.duration, option: base.option)
}

}
11 changes: 4 additions & 7 deletions EZProgressHUD/EZAnimations/EZAnimations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class EZAnimations {

@discardableResult
public static func transformX() -> CABasicAnimation {

let transformXScaleAnimation = CABasicAnimation(keyPath: EZStrings.transformScaleX.rawValue)
transformXScaleAnimation.fromValue = 1
transformXScaleAnimation.toValue = 1.02
Expand All @@ -43,9 +42,7 @@ public class EZAnimations {
public static func rotation(duration: CFTimeInterval,
rotationMode:RotationMode) -> CABasicAnimation {
var rotationAnimation = CABasicAnimation()

switch rotationMode {

case .xRotation:
rotationAnimation = CABasicAnimation(keyPath: EZStrings.transformRotationX.rawValue)
case .yRotation:
Expand All @@ -57,7 +54,6 @@ public class EZAnimations {

@discardableResult
public static func opacity() -> CABasicAnimation {

let opacityAnimation = CABasicAnimation(keyPath: EZStrings.opacity.rawValue)
opacityAnimation.fromValue = 1
opacityAnimation.toValue = 0.5
Expand All @@ -69,7 +65,6 @@ public class EZAnimations {

@discardableResult
public static func lineWidth(toValue: Any, duration: CFTimeInterval) -> CABasicAnimation {

let lineWidthAnimation = CABasicAnimation(keyPath: EZStrings.lineWidth.rawValue)
lineWidthAnimation.toValue = toValue
lineWidthAnimation.duration = duration
Expand All @@ -80,7 +75,6 @@ public class EZAnimations {

@discardableResult
public static func lineDashPhase(with object: LineDashPhaseArguments) -> CABasicAnimation {

let lineDashPhaseAnimation = CABasicAnimation(keyPath: EZStrings.lineDashPhase.rawValue)
lineDashPhaseAnimation.byValue = object.byValue
lineDashPhaseAnimation.duration = object.duration
Expand All @@ -94,28 +88,31 @@ public class EZAnimations {
public static func strokeEndAnimation(toValue:Any = 1.0,
duration:CFTimeInterval = 0.75,
option:CAMediaTimingFunctionName = .easeInEaseOut) -> CABasicAnimation {

let strokeEndAnimation = CABasicAnimation(keyPath: EZStrings.strokeEnd.rawValue)
strokeEndAnimation.toValue = 1.0
strokeEndAnimation.duration = 0.75
strokeEndAnimation.timingFunction = CAMediaTimingFunction(name: option)
setCommonAnimationProperties(animation: strokeEndAnimation)
return strokeEndAnimation
}

}

// MARK: - Set common animation properties

extension EZAnimations {

fileprivate class func setCommonAnimationProperties(animation: CABasicAnimation) {
animation.autoreverses = true
animation.repeatCount = .infinity
}

fileprivate class func rotationsCommons(animation: CABasicAnimation, duration: CFTimeInterval) {
animation.fromValue = 0
animation.toValue = CGFloat.pi * 2
animation.duration = duration
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
setCommonAnimationProperties(animation: animation)
}

}
9 changes: 1 addition & 8 deletions EZProgressHUD/EZBaseView/EZBaseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,18 @@ open class EZBaseView: UIView {

/// this method set the circles position, path, fillColor and.........
public func layerGenerator(shapeLayer: CAShapeLayer, type: ShapeLayerType) {

switch type {

case .firstShapeLayer:
shapeLayer.strokeColor = options.firstLayerStrokeColor.cgColor
case .secondShapeLayer:
shapeLayer.strokeColor = options.secondLayerStrokeColor.withAlphaComponent(0.42).cgColor
case .thirdShapeLayer:
shapeLayer.strokeColor = options.thirdLayerStrokeColor.cgColor
}

let circularTrackPath = UIBezierPath(arcCenter: .zero,
radius: options.radius,
startAngle: -(.pi) , endAngle:2 * .pi,
clockwise: true)

shapeLayer.position = transView.center
shapeLayer.path = circularTrackPath.cgPath
shapeLayer.lineWidth = options.strokeWidth
Expand All @@ -88,14 +84,12 @@ open class EZBaseView: UIView {
}

public func showBlock() {

UIApplication.shared.keyWindow?.isUserInteractionEnabled = false
UIApplication.shared.keyWindow?.addSubview(transView)
transViewAnimation(completion: nil)
}

public func dismissBlock(completion: (() -> Void)?) {

let completionHandler = { (success:Bool) in
self.transView.removeFromSuperview()
UIApplication.shared.keyWindow?.isUserInteractionEnabled = true
Expand All @@ -109,10 +103,9 @@ open class EZBaseView: UIView {
UIView.animate(withDuration: 0.2, delay: 0.0,
options: .curveEaseInOut,
animations: { [weak self] in

guard let self = self else { return }

(self.transView.alpha != 0) ? (self.transView.alpha = 0) : (self.transView.alpha = 1)
}, completion: completion)
}

}
20 changes: 1 addition & 19 deletions EZProgressHUD/EZFactory/EZFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,15 @@ public struct EZProgressHUD {

@discardableResult
public static func setProgress(with options:EZProgressOptions) -> EZProgress {

switch options.animationOption {

case .heartBeat:

return HeartBeat(options: options)

case .lineLayer:

return LineLayer(options: options)

case .lordOfTheRings:

return LordOfTheRings(options: options)

case .antColony:

return AntColony(options: options)

default:
return rotationBasedProgress(with: options)
}
Expand All @@ -43,27 +33,19 @@ public struct EZProgressHUD {
@discardableResult
private static func rotationBasedProgress(with options:EZProgressOptions)
-> EZProgress {

switch options.animationOption {
case .xRotation:

return XRotation(options: options)

case .xyRotation:

return XYRotation(options: options)

case .yRotation:

return YRotation(options: options)

case .hnk:

return HNK(options: options)

default:
return HeartBeat(options: options)
}
}

}

2 changes: 1 addition & 1 deletion EZProgressHUD/EZOthers/EZStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ public enum EZStrings:String {
case hsKey7
case hsKey8
case hsKey9

}

4 changes: 3 additions & 1 deletion EZProgressHUD/EZProgressOptions/EZProgressOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class EZTitleOptions {

/// color of title text (by default is white)
public var titleTextColor: UIColor = .white

}

@requires_stored_property_inits
Expand All @@ -51,6 +52,7 @@ public class EZProgressColorOptions: EZTitleOptions {

/// the background transparent view color (by default is black)
public var transViewBackgroundColor: UIColor = UIColor.black

}

@requires_stored_property_inits
Expand All @@ -73,5 +75,5 @@ public class EZProgressOptions: EZProgressColorOptions {
super.init()
options(self)
}

}

1 change: 1 addition & 0 deletions EZProgressHUD/EZProgresses/AntColony.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ final public class AntColony: EZBaseProgresses {
titleAnimations()
lineDashAnimation()
}

}

// MARK: - Methods
Expand Down
2 changes: 2 additions & 0 deletions EZProgressHUD/EZProgresses/EZBaseProgresses.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class EZBaseProgresses: EZBaseView {}
// MARK: EZProgressProtocol Impelementation

extension EZBaseProgresses: EZProgress {

public func show() {
setLayers()
showBlock()
Expand All @@ -21,6 +22,7 @@ extension EZBaseProgresses: EZProgress {
public func dismiss(completion: (() -> Void)?) {
dismissBlock(completion: completion)
}

}

// MARK: Set Animation And Layers
Expand Down
2 changes: 2 additions & 0 deletions EZProgressHUD/EZProgresses/HNK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ final public class HNK: EZBaseProgresses {
dashAnimations()
strokeEndAndTitleAnimations()
}

}

// MARK: - Methods
Expand Down Expand Up @@ -70,4 +71,5 @@ extension HNK {
titleLabel.layer.add(opacityAnimation, forKey: EZStrings.hsKey3.rawValue)
firstShapeLayer.add(strokeEndAnimation, forKey: EZStrings.hsKey7.rawValue)
}

}
4 changes: 3 additions & 1 deletion EZProgressHUD/EZProgresses/HeartBeat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import UIKit

final public class HeartBeat: EZBaseProgresses {

public override func setAnimation() {
transformAnimations()
titleAnimations()
}

}

// MARK: - Methods
Expand All @@ -35,10 +37,10 @@ extension HeartBeat {
private func titleAnimations() {
let opacityAnimation = EZAnimations.opacity()
let transformXScaleAnimation = EZAnimations.transformX()

titleLabel.layer.add(opacityAnimation,
forKey: EZStrings.hsKey2.rawValue)
titleLabel.layer.add(transformXScaleAnimation,
forKey: EZStrings.hsKey3.rawValue)
}

}
2 changes: 2 additions & 0 deletions EZProgressHUD/EZProgresses/LineLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import UIKit

final public class LineLayer: EZBaseProgresses {

fileprivate func setProperties() {
firstShapeLayer.lineWidth = (options.strokeWidth / 4) + 1
firstShapeLayer.lineDashPattern = [5]
Expand All @@ -23,6 +24,7 @@ final public class LineLayer: EZBaseProgresses {
lineDashAnimations()
opacityAndStrokeAnimations()
}

}

// MARK: - Methods
Expand Down
2 changes: 2 additions & 0 deletions EZProgressHUD/EZProgresses/LordOfTheRings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
import UIKit

final public class LordOfTheRings: EZBaseProgresses {

public override func setAnimation() {
firstLayerNTitleAnimations()
secondLayerAnimations()
thirdLayerAnimation()
titleOpacityAnimation()
}

}

// MARK: - Methods
Expand Down
2 changes: 2 additions & 0 deletions EZProgressHUD/EZProgresses/XRotation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import UIKit

final public class XRotation: EZBaseProgresses {

public override func setAnimation() {
transformScale()
xRotation()
opacity()
}

}

// MARK: - Methods
Expand Down
Loading

0 comments on commit 85a613c

Please sign in to comment.