3 Commits

Author SHA1 Message Date
Kaunteya Suryawanshi 6d011fd523 Cleanup 2018-10-10 12:31:12 +05:30
Kaunteya Suryawanshi b7f936dd4f Merge pull request #19 from EpicDraws/master
Changes to support Swift 4.2
2018-10-10 12:15:36 +05:30
EpicDraws 4a02dd081a Changes to support Swift 4.2 2018-10-07 18:33:21 -07:00
10 changed files with 31 additions and 27 deletions
+3 -3
View File
@@ -46,7 +46,7 @@ open class CircularProgressView: DeterminateAnimation {
} else {
CATransaction.setDisableActions(true)
}
let timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
let timing = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
CATransaction.setAnimationTimingFunction(timing)
progressLayer.strokeEnd = max(0, min(progress, 1))
percentLabelLayer.string = "\(Int(progress * 100))%"
@@ -77,7 +77,7 @@ open class CircularProgressView: DeterminateAnimation {
do {
progressLayer.strokeEnd = 0 //REMOVe this
progressLayer.fillColor = NSColor.clear.cgColor
progressLayer.lineCap = kCALineCapRound
progressLayer.lineCap = .round
progressLayer.lineWidth = strokeWidth == -1 ? (rect.width * strokeScalingFactor) : strokeWidth
progressLayer.frame = rect
@@ -95,7 +95,7 @@ open class CircularProgressView: DeterminateAnimation {
percentLabelLayer.foregroundColor = foreground.cgColor
percentLabelLayer.frame = rect
percentLabelLayer.font = "Helvetica Neue Light" as CFTypeRef
percentLabelLayer.alignmentMode = kCAAlignmentCenter
percentLabelLayer.alignmentMode = CATextLayerAlignmentMode.center
percentLabelLayer.position.y = rect.midY * 0.25
percentLabelLayer.fontSize = rect.width * 0.2
self.layer?.addSublayer(percentLabelLayer)
+2 -2
View File
@@ -15,7 +15,7 @@ open class ProgressBar: DeterminateAnimation {
open var borderLayer = CAShapeLayer()
open var progressLayer = CAShapeLayer()
@IBInspectable open var borderColor: NSColor = NSColor.black {
@IBInspectable open var borderColor: NSColor = .black {
didSet {
notifyViewRedesigned()
}
@@ -51,7 +51,7 @@ open class ProgressBar: DeterminateAnimation {
} else {
CATransaction.setDisableActions(true)
}
let timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
let timing = CAMediaTimingFunction(name: .easeOut)
CATransaction.setAnimationTimingFunction(timing)
progressLayer.frame.size.width = (borderLayer.bounds.width - 6) * progress
CATransaction.commit()
+3 -3
View File
@@ -52,14 +52,14 @@ open class Crawler: IndeterminateAnimation {
let rotationAnimation = CAKeyframeAnimation(keyPath: "position")
rotationAnimation.path = arcPath.CGPath
rotationAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
rotationAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
rotationAnimation.beginTime = (duration * 0.075) * Double(i)
rotationAnimation.calculationMode = kCAAnimationCubicPaced
rotationAnimation.calculationMode = .cubicPaced
let animationGroup = CAAnimationGroup()
animationGroup.animations = [rotationAnimation]
animationGroup.duration = duration
animationGroup.repeatCount = Float.infinity
animationGroup.repeatCount = .infinity
animationGroups.append(animationGroup)
}
+2 -2
View File
@@ -31,7 +31,7 @@ open class MaterialProgress: IndeterminateAnimation {
var progressLayer: CAShapeLayer = {
var tempLayer = CAShapeLayer()
tempLayer.strokeEnd = CGFloat(strokeRange.end)
tempLayer.lineCap = kCALineCapRound
tempLayer.lineCap = .round
tempLayer.fillColor = NSColor.clear.cgColor
return tempLayer
}()
@@ -64,7 +64,7 @@ open class MaterialProgress: IndeterminateAnimation {
let tempAnimation = CABasicAnimation(keyPath: keyPath)
tempAnimation.repeatCount = 1
tempAnimation.speed = 2.0
tempAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
tempAnimation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
tempAnimation.fromValue = strokeRange.start
tempAnimation.toValue = strokeRange.end
+1 -1
View File
@@ -41,7 +41,7 @@ open class RotatingArc: IndeterminateAnimation {
var rotationAnimation: CABasicAnimation = {
var tempRotation = CABasicAnimation(keyPath: "transform.rotation")
tempRotation.repeatCount = Float.infinity
tempRotation.repeatCount = .infinity
tempRotation.fromValue = 0
tempRotation.toValue = 1
tempRotation.isCumulative = true
+3 -3
View File
@@ -51,9 +51,9 @@ open class ShootingStars: IndeterminateAnimation {
animation.fromValue = -dimension
animation.toValue = rect.width * 0.9
animation.duration = animationDuration
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
animation.timingFunction = CAMediaTimingFunction(name: .easeIn)
animation.isRemovedOnCompletion = false
animation.repeatCount = Float.infinity
animation.repeatCount = .infinity
}
/** Temp animation will be removed after first animation
@@ -64,7 +64,7 @@ open class ShootingStars: IndeterminateAnimation {
tempAnimation.toValue = rect.width
tempAnimation.delegate = self
tempAnimation.duration = animationDuration / 2
tempAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
tempAnimation.timingFunction = CAMediaTimingFunction(name: .easeIn)
}
//MARK: Indeterminable protocol
+2 -2
View File
@@ -18,8 +18,8 @@ open class Spinner: IndeterminateAnimation {
var animation: CAKeyframeAnimation = {
var animation = CAKeyframeAnimation(keyPath: "transform.rotation")
animation.repeatCount = Float.infinity
animation.calculationMode = kCAAnimationDiscrete
animation.repeatCount = .infinity
animation.calculationMode = .discrete
return animation
}()
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'ProgressKit'
spec.version = '0.7'
spec.version = '0.8'
spec.license = 'MIT'
spec.summary = 'Animated ProgressViews for macOS'
spec.homepage = 'https://github.com/kaunteya/ProgressKit'
+9 -5
View File
@@ -213,7 +213,7 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Kauntey Suryawanshi";
TargetAttributes = {
E3AD65D11B426758009541CD = {
@@ -329,12 +329,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -382,12 +384,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -424,8 +428,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -438,8 +442,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
};
name = Release;
};
+5 -5
View File
@@ -25,18 +25,18 @@ extension NSBezierPath {
for index in 0..<numElements {
let pathType = self.element(at: index, associatedPoints: points)
switch pathType {
case .moveToBezierPathElement:
case .moveTo:
path.move(to: points[0])
case .lineToBezierPathElement:
case .lineTo:
path.addLine(to: points[0])
case .curveToBezierPathElement:
case .curveTo:
path.addCurve(to: points[2], control1: points[0], control2: points[1])
case .closePathBezierPathElement:
case .closePath:
path.closeSubpath()
}
}
points.deallocate(capacity: 3)
points.deallocate()
return path
}
}