Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set progress completion handler bug #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public struct ProgressRing {
}
}

open class ProgressRingLayer: CAShapeLayer {
open class ProgressRingLayer: CAShapeLayer, CAAnimationDelegate {
var completion: (() -> Void)?

open var progress: CGFloat? {
Expand Down Expand Up @@ -65,12 +65,13 @@ open class ProgressRingLayer: CAShapeLayer {
animation.fromValue = strokeEnd
animation.toValue = progress
animation.duration = CFTimeInterval(duration)
animation.delegate = self as? CAAnimationDelegate
animation.delegate = self
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
strokeEnd = progress
self.completion = completion
add(animation, forKey: "strokeEnd")
}

open func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
if flag {
completion?()
Expand Down
43 changes: 7 additions & 36 deletions Example/ConcentricProgressRingView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
37C0F5AA1FCD042B000DB42E /* Frameworks */,
37C0F5AB1FCD042B000DB42E /* Resources */,
11C974A427414FF6EA0DA125 /* [CP] Embed Pods Frameworks */,
9A69ED98045307F6B3D674E8 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -192,7 +191,6 @@
607FACCD1AFB9204008FA782 /* Frameworks */,
607FACCE1AFB9204008FA782 /* Resources */,
2C3C1F016294790D384E9860 /* [CP] Embed Pods Frameworks */,
E0132CBC779D0E2D6D0EA701 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -231,6 +229,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -272,7 +271,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ConcentricProgressRingView_ExampleTests/Pods-ConcentricProgressRingView_ExampleTests-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-ConcentricProgressRingView_ExampleTests/Pods-ConcentricProgressRingView_ExampleTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework",
"${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
);
Expand All @@ -283,7 +282,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConcentricProgressRingView_ExampleTests/Pods-ConcentricProgressRingView_ExampleTests-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ConcentricProgressRingView_ExampleTests/Pods-ConcentricProgressRingView_ExampleTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
1DD8B60693DAF6CF0C05F5BC /* [CP] Check Pods Manifest.lock */ = {
Expand All @@ -310,7 +309,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ConcentricProgressRingView_Example/Pods-ConcentricProgressRingView_Example-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-ConcentricProgressRingView_Example/Pods-ConcentricProgressRingView_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/ConcentricProgressRingView/ConcentricProgressRingView.framework",
"${BUILT_PRODUCTS_DIR}/LionheartExtensions/LionheartExtensions.framework",
);
Expand All @@ -321,7 +320,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConcentricProgressRingView_Example/Pods-ConcentricProgressRingView_Example-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ConcentricProgressRingView_Example/Pods-ConcentricProgressRingView_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
40C7B7A9C43CFF5CECC1DB0A /* [CP] Check Pods Manifest.lock */ = {
Expand All @@ -342,36 +341,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9A69ED98045307F6B3D674E8 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConcentricProgressRingView_ExampleTests/Pods-ConcentricProgressRingView_ExampleTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
E0132CBC779D0E2D6D0EA701 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConcentricProgressRingView_Example/Pods-ConcentricProgressRingView_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -582,6 +551,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 63553QQ62F;
INFOPLIST_FILE = ConcentricProgressRingView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
Expand All @@ -598,6 +568,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 63553QQ62F;
INFOPLIST_FILE = ConcentricProgressRingView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
Expand Down
2 changes: 1 addition & 1 deletion Example/ConcentricProgressRingView/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ViewController: UIViewController {

let f = Int64(0.2 * Double(index) * Double(NSEC_PER_SEC))
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(f) / Double(NSEC_PER_SEC), execute: {
self.progressRingView[index].setProgress(CGFloat(drand48()), duration: max(0.4, CGFloat(drand48())))
self.progressRingView[index].setProgress(CGFloat(drand48()), duration: max(0.4, CGFloat(drand48()))){print("completion")}
})
}
}
Expand Down
14 changes: 10 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- ConcentricProgressRingView (2.0.0):
- ConcentricProgressRingView (2.0.2):
- LionheartExtensions
- LionheartExtensions (3.11.4):
- LionheartExtensions/Core (= 3.11.4)
Expand All @@ -13,16 +13,22 @@ DEPENDENCIES:
- Nimble (~> 7)
- Quick (~> 1)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- LionheartExtensions
- Nimble
- Quick

EXTERNAL SOURCES:
ConcentricProgressRingView:
:path: ../
:path: "../"

SPEC CHECKSUMS:
ConcentricProgressRingView: b7994d3cdb3421c8273750a18f4efa171e628a71
ConcentricProgressRingView: e123c811722e610aeeb40201abf033b23fd393aa
LionheartExtensions: 1cb1f17f3d75ff48757d6aeeb40fbe9f9516e300
Nimble: 7f5a9c447a33002645a071bddafbfb24ea70e0ac
Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08

PODFILE CHECKSUM: 9870839634870d9146dc16ddb8cc0bbe0be1bb88

COCOAPODS: 1.4.0
COCOAPODS: 1.6.1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading