60 Commits

Author SHA1 Message Date
Kaan Dedeoglu 904cb5fde9 Update podspec version to 1.5.3. 2017-09-13 19:19:51 +02:00
Kaan Dedeoglu 2d1d00f381 Update README.md 2017-04-11 14:53:17 +02:00
Kaan Dedeoglu bec3dafb2c Merge pull request #61 from iBicha/patch-1
removed isUserInteractionEnabled = false from init
2017-01-09 08:57:23 +02:00
Brahim Hadriche 0aed134ea3 removed isUserInteractionEnabled = false from init
closes https://github.com/kaandedeoglu/KDCircularProgress/issues/60
2017-01-09 00:00:29 +01:00
Kaan Dedeoglu cbe03ad40c Merge pull request #53 from yakoobs/Issue#33
Fix an issue with animation immediately finish when you press home bu…
2016-11-09 10:39:22 +02:00
Kuba Sokolowski 0447a3d5eb Fix an issue with animation immediately finish when you press home button and open back the app. 2016-11-08 20:02:02 +01:00
Kaan Dedeoglu 9a74a70278 progressColors doesn't have to be @IBInspectable since it has no effect. 2016-10-05 00:42:16 +03:00
Kaan Dedeoglu 8e5a2cc59d Update LICENSE
Update year to 2016
2016-09-21 21:22:24 +03:00
Kaan Dedeoglu adb66054af Update README.md 2016-09-21 21:21:07 +03:00
Kaan Dedeoglu 5345928bfe More project setting changes. 2016-09-21 20:53:36 +03:00
Kaan Dedeoglu 33f6d27ff3 Some project setting changes 2016-09-21 20:43:03 +03:00
Kaan Dedeoglu 6f7a685c73 Complete overhaul of the Xcode project structure. Should support Carthage now. 2016-09-21 20:24:50 +03:00
Kaan Dedeoglu 8aaa5325d3 Update .gitignore 2016-09-21 20:23:16 +03:00
Kaan Dedeoglu b7c304f9eb Create Cocoa Touch Framework target and share the scheme for Carthage support. 2016-09-21 19:53:33 +03:00
Kaan Dedeoglu 18690e9771 Update the podspec to version 1.5.2 since 1.5.1 caused some problems after moving tags. 2016-09-21 19:43:42 +03:00
Kaan Dedeoglu f8d9edb269 Update README.md 2016-09-21 19:42:49 +03:00
Kaan Dedeoglu 03955bacfe Update README.md 2016-09-21 19:42:16 +03:00
Kaan Dedeoglu 7d05adf351 Move screenshots to their own Assets folder 2016-09-21 19:41:35 +03:00
Kaan Dedeoglu a7644df9ba Fix more uses of the old setColors(colors: ...). Update podspec to version 1.5.1 2016-09-21 19:30:58 +03:00
Kaan Dedeoglu f85ba09cc1 Change setColors(colors: ..) method signatures set(colors: ...) - following the new naming scheme. Update README. 2016-09-21 19:27:28 +03:00
Kaan Dedeoglu af627388be Update readme about Swift 2.0 & 2.3 tags for Cocoapods users 2016-09-21 00:26:17 +03:00
Kaan Dedeoglu 6b2b815c8b Get rid of implicitly unwrapped optionals, replace them with initial values. 2016-09-20 10:39:21 +03:00
Kaan Dedeoglu fbd7293f78 Refactor and cleanup. Make sure the animationCompletion block is always called if it exists, passing the correct completed flag. 2016-09-20 10:31:54 +03:00
Kaan Dedeoglu ff704621e9 add .swift-version file 2016-09-11 21:32:20 +03:00
Kaan Dedeoglu 39b9e6bd1c Clamp the value in progress setter to the interval [0,1] 2016-09-11 21:04:02 +03:00
Kaan Dedeoglu 797a5ba108 Merge pull request #41 from sonersoysal/master
Add Progress Variable
2016-09-11 21:01:17 +03:00
Kaan Dedeoglu 5e2d0a8d5a Update README.md 2016-09-11 20:42:57 +03:00
Kaan Dedeoglu 9cee5ecd92 Update README.md 2016-09-11 20:42:18 +03:00
Kaan Dedeoglu 087361dc92 Merge branch 'swift3' 2016-09-11 20:38:27 +03:00
Soner Soysal 441acb0ddb Update README.md 2016-09-07 16:23:52 +03:00
Soner Soysal 5609e781ef Add Progress Variable 2016-09-07 16:10:50 +03:00
Kaan Dedeoglu 427d5d5592 Update for Xcode 8 beta 6. 2016-08-17 11:02:46 +03:00
Kaan Dedeoglu edeba04ff9 Merge pull request #36 from Morbix/patch-3
Update README.md
2016-07-26 14:07:14 +03:00
Kaan Dedeoglu f185b1f33d Merge pull request #34 from Morbix/patch-1
Adding CocoaPods badges
2016-07-26 14:06:58 +03:00
Henrique Morbin 79bf0d3457 Update README.md
Fix
2016-07-25 20:51:16 -03:00
Kaan Dedeoglu 4f2cfc1687 Merge pull request #35 from Morbix/patch-2
Update README.md
2016-07-26 01:11:40 +03:00
Henrique Morbin 174357710b Update README.md 2016-07-25 17:06:51 -03:00
Henrique Morbin f10c403fc2 Adding CocoaPods badges 2016-07-25 17:04:05 -03:00
Kaan Dedeoglu 1e16600001 cherry pick 3c38489 into our Swift3 branch. 2016-07-21 13:10:55 +03:00
Kaan Dedeoglu 094a5a64e5 bump version to 1.4.1 2016-07-21 12:36:01 +03:00
Kaan Dedeoglu 3c38489154 clear the current completionBlock variable before calling it. fixes #31 2016-07-21 12:35:08 +03:00
Kaan Dedeoglu 1d9ab519f1 Merge pull request #26 from stevekim0417/master
Master
2016-06-23 17:56:26 +03:00
Macbook 60d95709c7 Merge remote-tracking branch 'kaandedeoglu/master' 2016-06-23 23:49:16 +09:00
Macbook 0e95379f6d flag
It is not called the completion block after doing cancel.
2016-06-23 23:44:18 +09:00
Kaan Dedeoglu d15df140c4 Update to recommended project settings. 2016-06-21 01:47:13 +03:00
Kaan Dedeoglu 63ae2ea28d Update Podspec to 1.5.0-beta1 2016-06-21 01:24:13 +03:00
Kaan Dedeoglu 69a0cd0640 Update to Swift 3.0 and Xcode 8 2016-06-21 01:19:59 +03:00
Kaan Dedeoglu 840ae1fcbc Clean up and refactoring 2016-06-21 00:29:41 +03:00
Steve Kim 36160ed532 issue : not calling completion block after doing cancel
It works fine after doing cancel.
2016-05-29 16:04:06 +09:00
Kaan Dedeoglu d96c0a95a3 Merge pull request #19 from aborren/master
Changed angle to Double instead of Int
2016-04-06 14:04:03 +03:00
Dan Isacson e9d2ffa247 update podspec to 1.4.0 2016-04-04 14:35:55 +02:00
Dan Isacson 0b46df2ce7 Changed angle to use Double instead of Int. This change was made in order to make slow animations smoother. 2016-04-04 13:30:47 +02:00
Kaan Dedeoglu e5b6e5caf9 Avoid var parameters - which will be deprecated with Swift 3.0 2016-03-28 00:25:51 +03:00
Kaan Dedeoglu fee2df5cfd Update Podspec to 1.3.4 2016-03-27 13:46:21 +03:00
Kaan Dedeoglu 5726166d3d Merge pull request #18 from maltalef/master
Added colorLerpMode
2016-03-27 13:45:05 +03:00
Matias Altalef 55f1893864 Added colorLerpMode (default false): when true, it's filled with a solid color that changes with progress (only if there's more than one) 2016-03-26 18:02:19 -03:00
Kaan Dedeoglu bf388402fd Merge pull request #17 from ReadmeCritic/master
Correct the spelling of CocoaPods in README
2016-02-12 21:22:31 +02:00
ReadmeCritic f814654106 Correct the spelling of CocoaPods in README 2016-02-12 11:17:11 -08:00
Kaan Dedeoglu eeacb59a55 Make sure the presentationLayer is non-nil before trying to pause animations. Update to version 1.3.3 2016-01-27 12:07:46 +02:00
Kaan Dedeoglu ee5890b8ce Update Podspec to 1.3.2 2016-01-10 11:37:53 +02:00
31 changed files with 1162 additions and 908 deletions
+23 -10
View File
@@ -1,6 +1,13 @@
# Mac OS X
.DS_Store
# Xcode
#
## Build generated
build/
DerivedData
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
@@ -10,17 +17,23 @@ build/
*.perspectivev3
!default.perspectivev3
xcuserdata
## Other
*.xccheckout
*.moved-aside
DerivedData
*.xcuserstate
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.xcuserstate
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Pods/
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
.build/
# Carthage
Carthage/Build
+1
View File
@@ -0,0 +1 @@
3.0

Before

Width:  |  Height:  |  Size: 861 KiB

After

Width:  |  Height:  |  Size: 861 KiB

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

@@ -0,0 +1,341 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
BC5B0C1D1D92F75600B43506 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC5B0C1C1D92F75600B43506 /* AppDelegate.swift */; };
BC5B0C1F1D92F75600B43506 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC5B0C1E1D92F75600B43506 /* ViewController.swift */; };
BC5B0C221D92F75600B43506 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BC5B0C201D92F75600B43506 /* Main.storyboard */; };
BC5B0C241D92F75600B43506 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BC5B0C231D92F75600B43506 /* Assets.xcassets */; };
BC5B0C271D92F75600B43506 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BC5B0C251D92F75600B43506 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
BC6FF0C61D92FEA9002E6571 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BC5B0C2E1D92F76E00B43506 /* KDCircularProgress.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = BC5B0BE81D92F4FA00B43506;
remoteInfo = "KDCircularProgress iOS";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
BC5B0C191D92F75600B43506 /* iOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
BC5B0C1C1D92F75600B43506 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
BC5B0C1E1D92F75600B43506 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
BC5B0C211D92F75600B43506 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
BC5B0C231D92F75600B43506 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
BC5B0C261D92F75600B43506 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
BC5B0C281D92F75600B43506 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BC5B0C2E1D92F76E00B43506 /* KDCircularProgress.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = KDCircularProgress.xcodeproj; path = ../../KDCircularProgress.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
BC5B0C161D92F75600B43506 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
BC5B0C101D92F75600B43506 = {
isa = PBXGroup;
children = (
BC5B0C1B1D92F75600B43506 /* iOS Example */,
BC5B0C1A1D92F75600B43506 /* Products */,
BC5B0C2E1D92F76E00B43506 /* KDCircularProgress.xcodeproj */,
);
sourceTree = "<group>";
};
BC5B0C1A1D92F75600B43506 /* Products */ = {
isa = PBXGroup;
children = (
BC5B0C191D92F75600B43506 /* iOS Example.app */,
);
name = Products;
sourceTree = "<group>";
};
BC5B0C1B1D92F75600B43506 /* iOS Example */ = {
isa = PBXGroup;
children = (
BC5B0C1C1D92F75600B43506 /* AppDelegate.swift */,
BC5B0C1E1D92F75600B43506 /* ViewController.swift */,
BC5B0C201D92F75600B43506 /* Main.storyboard */,
BC5B0C231D92F75600B43506 /* Assets.xcassets */,
BC5B0C251D92F75600B43506 /* LaunchScreen.storyboard */,
BC5B0C281D92F75600B43506 /* Info.plist */,
);
path = "iOS Example";
sourceTree = "<group>";
};
BC6FF0C21D92FEA8002E6571 /* Products */ = {
isa = PBXGroup;
children = (
BC6FF0C71D92FEA9002E6571 /* KDCircularProgress.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
BC5B0C181D92F75600B43506 /* iOS Example */ = {
isa = PBXNativeTarget;
buildConfigurationList = BC5B0C2B1D92F75600B43506 /* Build configuration list for PBXNativeTarget "iOS Example" */;
buildPhases = (
BC5B0C151D92F75600B43506 /* Sources */,
BC5B0C161D92F75600B43506 /* Frameworks */,
BC5B0C171D92F75600B43506 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "iOS Example";
productName = "iOS Example";
productReference = BC5B0C191D92F75600B43506 /* iOS Example.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
BC5B0C111D92F75600B43506 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Kaan Dedeoglu";
TargetAttributes = {
BC5B0C181D92F75600B43506 = {
CreatedOnToolsVersion = 8.0;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = BC5B0C141D92F75600B43506 /* Build configuration list for PBXProject "iOS Example" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = BC5B0C101D92F75600B43506;
productRefGroup = BC5B0C1A1D92F75600B43506 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = BC6FF0C21D92FEA8002E6571 /* Products */;
ProjectRef = BC5B0C2E1D92F76E00B43506 /* KDCircularProgress.xcodeproj */;
},
);
projectRoot = "";
targets = (
BC5B0C181D92F75600B43506 /* iOS Example */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
BC6FF0C71D92FEA9002E6571 /* KDCircularProgress.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = KDCircularProgress.framework;
remoteRef = BC6FF0C61D92FEA9002E6571 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
BC5B0C171D92F75600B43506 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BC5B0C271D92F75600B43506 /* LaunchScreen.storyboard in Resources */,
BC5B0C241D92F75600B43506 /* Assets.xcassets in Resources */,
BC5B0C221D92F75600B43506 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
BC5B0C151D92F75600B43506 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BC5B0C1F1D92F75600B43506 /* ViewController.swift in Sources */,
BC5B0C1D1D92F75600B43506 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
BC5B0C201D92F75600B43506 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
BC5B0C211D92F75600B43506 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
BC5B0C251D92F75600B43506 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
BC5B0C261D92F75600B43506 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
BC5B0C291D92F75600B43506 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
BC5B0C2A1D92F75600B43506 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
BC5B0C2C1D92F75600B43506 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = "iOS Example/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kaandedeoglu.KDCircularProgress.iOS-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
BC5B0C2D1D92F75600B43506 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = "iOS Example/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kaandedeoglu.KDCircularProgress.iOS-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
BC5B0C141D92F75600B43506 /* Build configuration list for PBXProject "iOS Example" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BC5B0C291D92F75600B43506 /* Debug */,
BC5B0C2A1D92F75600B43506 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BC5B0C2B1D92F75600B43506 /* Build configuration list for PBXNativeTarget "iOS Example" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BC5B0C2C1D92F75600B43506 /* Debug */,
BC5B0C2D1D92F75600B43506 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = BC5B0C111D92F75600B43506 /* Project object */;
}
@@ -1,9 +1,9 @@
//
// AppDelegate.swift
// KDCircularProgressExample
// iOS Example
//
// Created by Kaan Dedeoglu on 2/12/15.
// Copyright (c) 2015 Kaan Dedeoglu. All rights reserved.
// Created by Kaan Dedeoglu on 9/21/16.
// Copyright © 2016 Kaan Dedeoglu. All rights reserved.
//
import UIKit
@@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
@@ -1,68 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A319" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="9wL-Dp-scG">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<scene sceneID="Fjt-bB-ckB">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="KDCircularProgressExample" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="9wL-Dp-scG" customClass="ViewController" customModule="iOS_Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="ghF-CJ-0yv"/>
<viewControllerLayoutGuide type="bottom" id="o67-py-2aK"/>
<viewControllerLayoutGuide type="top" id="g4C-sr-w9g"/>
<viewControllerLayoutGuide type="bottom" id="yjB-on-Hkq"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<view key="view" contentMode="scaleToFill" id="nbo-Tj-Bre">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="360" translatesAutoresizingMaskIntoConstraints="NO" id="BHN-x6-Zsx">
<rect key="frame" x="61" y="478" width="198" height="31"/>
<animations/>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="360" translatesAutoresizingMaskIntoConstraints="NO" id="GNJ-D7-iKp">
<constraints>
<constraint firstAttribute="height" constant="30" id="6DH-hv-h4S"/>
<constraint firstAttribute="width" constant="194" id="oTI-kD-sOa"/>
<constraint firstAttribute="width" constant="194" id="Ngq-EV-BQc"/>
<constraint firstAttribute="height" constant="30" id="i7l-jw-4bx"/>
</constraints>
<connections>
<action selector="sliderDidChangeValue:" destination="vXZ-lx-hvc" eventType="valueChanged" id="Wfm-n6-qzL"/>
<action selector="sliderDidChangeValue:" destination="9wL-Dp-scG" eventType="valueChanged" id="NsE-GI-Orr"/>
</connections>
</slider>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5M2-Yi-RuL">
<rect key="frame" x="112" y="523" width="96" height="30"/>
<animations/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9ev-GJ-qTG">
<constraints>
<constraint firstAttribute="width" constant="96" id="T9z-qf-POZ"/>
<constraint firstAttribute="height" constant="30" id="h5a-bV-EMl"/>
<constraint firstAttribute="width" constant="96" id="Zrl-Sg-9Zb"/>
<constraint firstAttribute="height" constant="30" id="xHF-qf-Hbd"/>
</constraints>
<state key="normal" title="Animate">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="animateButtonTapped:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="b0F-cY-phl"/>
<action selector="animateButtonTapped:" destination="9wL-Dp-scG" eventType="touchUpInside" id="Av2-DJ-CaL"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wev-Tz-pfW" customClass="KDCircularProgress" customModule="KDCircularProgressExample" customModuleProvider="target">
<rect key="frame" x="60" y="20" width="200" height="200"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UvS-lo-pbU" customClass="KDCircularProgress" customModule="KDCircularProgress">
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="191-H5-EIc"/>
<constraint firstAttribute="width" secondItem="wev-Tz-pfW" secondAttribute="height" multiplier="1:1" id="Fsf-y4-1ta"/>
<constraint firstAttribute="width" secondItem="UvS-lo-pbU" secondAttribute="height" multiplier="1:1" id="uuX-Hh-HwZ"/>
<constraint firstAttribute="width" constant="200" id="zDC-WB-HLr"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="angle">
<integer key="value" value="320"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="IBColor1">
<color key="value" red="0.97441762909999996" green="1" blue="0.31255436479999998" alpha="1" colorSpace="calibratedRGB"/>
<color key="value" red="0.97441762909999996" green="1" blue="0.31255436479999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="IBColor2">
<color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="IBColor3">
<color key="value" red="0.085719833812801863" green="0.98039215690000003" blue="0.39604470297983985" alpha="1" colorSpace="calibratedRGB"/>
<color key="value" red="0.085719833810000007" green="0.98039215690000003" blue="0.396044703" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="startAngle">
<integer key="value" value="-90"/>
@@ -84,21 +79,20 @@
</userDefinedRuntimeAttributes>
</view>
</subviews>
<animations/>
<color key="backgroundColor" red="0.4736600907821229" green="0.4736600907821229" blue="0.4736600907821229" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.47366009079999999" green="0.47366009079999999" blue="0.47366009079999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="BHN-x6-Zsx" secondAttribute="centerX" id="Arq-5P-YRp"/>
<constraint firstItem="wev-Tz-pfW" firstAttribute="top" secondItem="ghF-CJ-0yv" secondAttribute="bottom" id="EcI-a0-AkN"/>
<constraint firstItem="5M2-Yi-RuL" firstAttribute="top" secondItem="BHN-x6-Zsx" secondAttribute="bottom" constant="15" id="GMQ-0i-VMb"/>
<constraint firstAttribute="centerX" secondItem="5M2-Yi-RuL" secondAttribute="centerX" id="IEH-Lm-rgx"/>
<constraint firstAttribute="centerX" secondItem="wev-Tz-pfW" secondAttribute="centerX" id="jKJ-82-cfb"/>
<constraint firstItem="o67-py-2aK" firstAttribute="top" secondItem="5M2-Yi-RuL" secondAttribute="bottom" constant="15" id="zhX-dr-Rnn"/>
<constraint firstAttribute="centerX" secondItem="9ev-GJ-qTG" secondAttribute="centerX" id="9yk-kN-NUL"/>
<constraint firstItem="yjB-on-Hkq" firstAttribute="top" secondItem="9ev-GJ-qTG" secondAttribute="bottom" constant="15" id="DSI-Wt-vfI"/>
<constraint firstAttribute="centerX" secondItem="UvS-lo-pbU" secondAttribute="centerX" id="FlC-G1-Xy3"/>
<constraint firstItem="UvS-lo-pbU" firstAttribute="top" secondItem="g4C-sr-w9g" secondAttribute="bottom" id="dqi-TN-cym"/>
<constraint firstAttribute="centerX" secondItem="GNJ-D7-iKp" secondAttribute="centerX" id="p8v-RV-Bqd"/>
<constraint firstItem="9ev-GJ-qTG" firstAttribute="top" secondItem="GNJ-D7-iKp" secondAttribute="bottom" constant="15" id="wOd-cK-tlp"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="CFY-zW-EEf" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="410" y="396"/>
<point key="canvasLocation" x="-370" y="104"/>
</scene>
</scenes>
</document>
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.kaandedeoglu.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -16,8 +16,6 @@
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
@@ -1,15 +1,15 @@
//
// ViewController.swift
// KDCircularProgressExample
// iOS Example
//
// Created by Kaan Dedeoglu on 2/12/15.
// Copyright (c) 2015 Kaan Dedeoglu. All rights reserved.
// Created by Kaan Dedeoglu on 9/21/16.
// Copyright © 2016 Kaan Dedeoglu. All rights reserved.
//
import UIKit
import KDCircularProgress
class ViewController: UIViewController {
var progress: KDCircularProgress!
override func viewDidLoad() {
@@ -23,19 +23,19 @@ class ViewController: UIViewController {
progress.clockwise = true
progress.gradientRotateSpeed = 2
progress.roundedCorners = false
progress.glowMode = .Forward
progress.glowMode = .forward
progress.glowAmount = 0.9
progress.setColors(UIColor.cyanColor() ,UIColor.whiteColor(), UIColor.magentaColor(), UIColor.whiteColor(), UIColor.orangeColor())
progress.set(colors: UIColor.cyan ,UIColor.white, UIColor.magenta, UIColor.white, UIColor.orange)
progress.center = CGPoint(x: view.center.x, y: view.center.y + 25)
view.addSubview(progress)
}
@IBAction func sliderDidChangeValue(sender: UISlider) {
progress.angle = Int(sender.value)
@IBAction func sliderDidChangeValue(_ sender: UISlider) {
progress.angle = Double(sender.value)
}
@IBAction func animateButtonTapped(sender: UIButton) {
progress.animateFromAngle(0, toAngle: 360, duration: 5) { completed in
@IBAction func animateButtonTapped(_ sender: UIButton) {
progress.animate(fromAngle: 0, toAngle: 360, duration: 5) { completed in
if completed {
print("animation stopped, completed")
} else {
@@ -45,3 +45,4 @@ class ViewController: UIViewController {
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KDCircularProgress'
s.version = '1.3.1'
s.version = '1.5.3'
s.license = 'MIT'
s.summary = 'A circular progress view with gradients written in Swift'
s.homepage = 'https://github.com/kaandedeoglu/KDCircularProgress'
@@ -0,0 +1,305 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
BC5B0BED1D92F4FA00B43506 /* KDCircularProgress.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5B0BEB1D92F4FA00B43506 /* KDCircularProgress.h */; settings = {ATTRIBUTES = (Public, ); }; };
BC5B0BF11D92F50000B43506 /* KDCircularProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC5B0BE11D92F4AF00B43506 /* KDCircularProgress.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
BC5B0BE11D92F4AF00B43506 /* KDCircularProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = KDCircularProgress.swift; path = KDCircularProgress/KDCircularProgress.swift; sourceTree = "<group>"; };
BC5B0BE81D92F4FA00B43506 /* KDCircularProgress.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KDCircularProgress.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BC5B0BEB1D92F4FA00B43506 /* KDCircularProgress.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KDCircularProgress.h; path = KDCircularProgress/KDCircularProgress.h; sourceTree = "<group>"; };
BC5B0BEC1D92F4FA00B43506 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = KDCircularProgress/Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
BC5B0BE41D92F4FA00B43506 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
BC5B0BD81D92F42D00B43506 = {
isa = PBXGroup;
children = (
BC5B0BDF1D92F46F00B43506 /* Sources */,
BC5B0BE91D92F4FA00B43506 /* Products */,
);
sourceTree = "<group>";
};
BC5B0BDF1D92F46F00B43506 /* Sources */ = {
isa = PBXGroup;
children = (
BC5B0BE11D92F4AF00B43506 /* KDCircularProgress.swift */,
BC5B0BEB1D92F4FA00B43506 /* KDCircularProgress.h */,
BC5B0BEC1D92F4FA00B43506 /* Info.plist */,
);
name = Sources;
sourceTree = "<group>";
};
BC5B0BE91D92F4FA00B43506 /* Products */ = {
isa = PBXGroup;
children = (
BC5B0BE81D92F4FA00B43506 /* KDCircularProgress.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
BC5B0BE51D92F4FA00B43506 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
BC5B0BED1D92F4FA00B43506 /* KDCircularProgress.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
BC5B0BE71D92F4FA00B43506 /* KDCircularProgress iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = BC5B0BEE1D92F4FA00B43506 /* Build configuration list for PBXNativeTarget "KDCircularProgress iOS" */;
buildPhases = (
BC5B0BE31D92F4FA00B43506 /* Sources */,
BC5B0BE41D92F4FA00B43506 /* Frameworks */,
BC5B0BE51D92F4FA00B43506 /* Headers */,
BC5B0BE61D92F4FA00B43506 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "KDCircularProgress iOS";
productName = "KDCircularProgress iOS";
productReference = BC5B0BE81D92F4FA00B43506 /* KDCircularProgress.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
BC5B0BD91D92F42D00B43506 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
TargetAttributes = {
BC5B0BE71D92F4FA00B43506 = {
CreatedOnToolsVersion = 8.0;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = BC5B0BDC1D92F42D00B43506 /* Build configuration list for PBXProject "KDCircularProgress" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = BC5B0BD81D92F42D00B43506;
productRefGroup = BC5B0BE91D92F4FA00B43506 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
BC5B0BE71D92F4FA00B43506 /* KDCircularProgress iOS */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
BC5B0BE61D92F4FA00B43506 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
BC5B0BE31D92F4FA00B43506 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BC5B0BF11D92F50000B43506 /* KDCircularProgress.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
BC5B0BDD1D92F42D00B43506 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
};
name = Debug;
};
BC5B0BDE1D92F42D00B43506 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
};
name = Release;
};
BC5B0BEF1D92F4FA00B43506 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES_NONAGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = KDCircularProgress/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = kaandedeoglu.KDCircularProgress;
PRODUCT_NAME = KDCircularProgress;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
BC5B0BF01D92F4FA00B43506 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES_NONAGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = KDCircularProgress/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = kaandedeoglu.KDCircularProgress;
PRODUCT_NAME = KDCircularProgress;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
BC5B0BDC1D92F42D00B43506 /* Build configuration list for PBXProject "KDCircularProgress" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BC5B0BDD1D92F42D00B43506 /* Debug */,
BC5B0BDE1D92F42D00B43506 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BC5B0BEE1D92F4FA00B43506 /* Build configuration list for PBXNativeTarget "KDCircularProgress iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BC5B0BEF1D92F4FA00B43506 /* Debug */,
BC5B0BF01D92F4FA00B43506 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = BC5B0BD91D92F42D00B43506 /* Project object */;
}
@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:KDCircularProgressExample.xcodeproj">
location = "self:KDCircularProgress.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC5B0BE71D92F4FA00B43506"
BuildableName = "KDCircularProgress.framework"
BlueprintName = "KDCircularProgress iOS"
ReferencedContainer = "container:KDCircularProgress.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC5B0BE71D92F4FA00B43506"
BuildableName = "KDCircularProgress.framework"
BlueprintName = "KDCircularProgress iOS"
ReferencedContainer = "container:KDCircularProgress.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC5B0BE71D92F4FA00B43506"
BuildableName = "KDCircularProgress.framework"
BlueprintName = "KDCircularProgress iOS"
ReferencedContainer = "container:KDCircularProgress.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "container:KDCircularProgress.xcodeproj">
</FileRef>
<FileRef
location = "group:Example/iOS Example/iOS Example.xcodeproj">
</FileRef>
</Workspace>
@@ -7,18 +7,18 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.kaandedeoglu.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<string>1.5.2</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
+19
View File
@@ -0,0 +1,19 @@
//
// KDCircularProgress iOS.h
// KDCircularProgress iOS
//
// Created by Kaan Dedeoglu on 9/21/16.
//
//
#import <UIKit/UIKit.h>
//! Project version number for KDCircularProgress.
FOUNDATION_EXPORT double KDCircularProgressVersionNumber;
//! Project version string for KDCircularProgress.
FOUNDATION_EXPORT const unsigned char KDCircularProgressVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <KDCircularProgress/PublicHeader.h>
+198 -142
View File
@@ -9,24 +9,20 @@
import UIKit
public enum KDCircularProgressGlowMode {
case Forward, Reverse, Constant, NoGlow
case forward, reverse, constant, noGlow
}
@IBDesignable
public class KDCircularProgress: UIView {
public class KDCircularProgress: UIView, CAAnimationDelegate {
private struct ConversionFunctions {
static func DegreesToRadians (value:CGFloat) -> CGFloat {
return value * CGFloat(M_PI) / 180.0
}
static func RadiansToDegrees (value:CGFloat) -> CGFloat {
return value * 180.0 / CGFloat(M_PI)
private enum Conversion {
static func degreesToRadians (value:CGFloat) -> CGFloat {
return value * CGFloat.pi / 180.0
}
}
private struct UtilityFunctions {
static func Clamp<T: Comparable>(value: T, minMax: (T, T)) -> T {
private enum Utility {
static func clamp<T: Comparable>(value: T, minMax: (T, T)) -> T {
let (min, max) = minMax
if value < min {
return min
@@ -37,32 +33,61 @@ public class KDCircularProgress: UIView {
}
}
static func Mod(value: Int, range: Int, minMax: (Int, Int)) -> Int {
static func inverseLerp(value: CGFloat, minMax: (CGFloat, CGFloat)) -> CGFloat {
return (value - minMax.0) / (minMax.1 - minMax.0)
}
static func lerp(value: CGFloat, minMax: (CGFloat, CGFloat)) -> CGFloat {
return (minMax.1 - minMax.0) * value + minMax.0
}
static func colorLerp(value: CGFloat, minMax: (UIColor, UIColor)) -> UIColor {
let clampedValue = clamp(value: value, minMax: (0, 1))
let zero = CGFloat(0)
var (r0, g0, b0, a0) = (zero, zero, zero, zero)
minMax.0.getRed(&r0, green: &g0, blue: &b0, alpha: &a0)
var (r1, g1, b1, a1) = (zero, zero, zero, zero)
minMax.1.getRed(&r1, green: &g1, blue: &b1, alpha: &a1)
return UIColor(red: lerp(value: clampedValue, minMax: (r0, r1)), green: lerp(value: clampedValue, minMax: (g0, g1)), blue: lerp(value: clampedValue, minMax: (b0, b1)), alpha: lerp(value: clampedValue, minMax: (a0, a1)))
}
static func mod(value: Double, range: Double, minMax: (Double, Double)) -> Double {
let (min, max) = minMax
assert(abs(range) <= abs(max - min), "range should be <= than the interval")
if value >= min && value <= max {
return value
} else if value < min {
return Mod(value + range, range: range, minMax: minMax)
return mod(value: value + range, range: range, minMax: minMax)
} else {
return Mod(value - range, range: range, minMax: minMax)
return mod(value: value - range, range: range, minMax: minMax)
}
}
}
private var progressLayer: KDCircularProgressViewLayer! {
private var progressLayer: KDCircularProgressViewLayer {
get {
return layer as! KDCircularProgressViewLayer
}
}
private var radius: CGFloat! {
private var radius: CGFloat = 0 {
didSet {
progressLayer.radius = radius
}
}
@IBInspectable public var angle: Int = 0 {
public var progress: Double = 0 {
didSet {
let clampedProgress = Utility.clamp(value: progress, minMax: (0, 1))
angle = 360 * clampedProgress
}
}
@IBInspectable public var angle: Double = 0 {
didSet {
if self.isAnimating() {
self.pauseAnimation()
@@ -71,9 +96,10 @@ public class KDCircularProgress: UIView {
}
}
@IBInspectable public var startAngle: Int = 0 {
@IBInspectable public var startAngle: Double = 0 {
didSet {
progressLayer.startAngle = UtilityFunctions.Mod(startAngle, range: 360, minMax: (0,360))
startAngle = Utility.mod(value: startAngle, range: 360, minMax: (0, 360))
progressLayer.startAngle = startAngle
progressLayer.setNeedsDisplay()
}
}
@@ -91,6 +117,12 @@ public class KDCircularProgress: UIView {
}
}
@IBInspectable public var lerpColorMode: Bool = false {
didSet {
progressLayer.lerpColorMode = lerpColorMode
}
}
@IBInspectable public var gradientRotateSpeed: CGFloat = 0 {
didSet {
progressLayer.gradientRotateSpeed = gradientRotateSpeed
@@ -99,11 +131,12 @@ public class KDCircularProgress: UIView {
@IBInspectable public var glowAmount: CGFloat = 1.0 {//Between 0 and 1
didSet {
progressLayer.glowAmount = UtilityFunctions.Clamp(glowAmount, minMax: (0, 1))
glowAmount = Utility.clamp(value: glowAmount, minMax: (0, 1))
progressLayer.glowAmount = glowAmount
}
}
@IBInspectable public var glowMode: KDCircularProgressGlowMode = .Forward {
@IBInspectable public var glowMode: KDCircularProgressGlowMode = .forward {
didSet {
progressLayer.glowMode = glowMode
}
@@ -111,19 +144,19 @@ public class KDCircularProgress: UIView {
@IBInspectable public var progressThickness: CGFloat = 0.4 {//Between 0 and 1
didSet {
progressThickness = UtilityFunctions.Clamp(progressThickness, minMax: (0, 1))
progressThickness = Utility.clamp(value: progressThickness, minMax: (0, 1))
progressLayer.progressThickness = progressThickness/2
}
}
@IBInspectable public var trackThickness: CGFloat = 0.5 {//Between 0 and 1
didSet {
trackThickness = UtilityFunctions.Clamp(trackThickness, minMax: (0, 1))
trackThickness = Utility.clamp(value: trackThickness, minMax: (0, 1))
progressLayer.trackThickness = trackThickness/2
}
}
@IBInspectable public var trackColor: UIColor = UIColor.blackColor() {
@IBInspectable public var trackColor: UIColor = .black {
didSet {
progressLayer.trackColor = trackColor
progressLayer.setNeedsDisplay()
@@ -132,21 +165,17 @@ public class KDCircularProgress: UIView {
@IBInspectable public var progressInsideFillColor: UIColor? = nil {
didSet {
if let color = progressInsideFillColor {
progressLayer.progressInsideFillColor = color
} else {
progressLayer.progressInsideFillColor = UIColor.clearColor()
}
progressLayer.progressInsideFillColor = progressInsideFillColor ?? .clear
}
}
@IBInspectable public var progressColors: [UIColor]! {
public var progressColors: [UIColor] {
get {
return progressLayer.colorsArray
}
set(newValue) {
setColors(newValue)
set {
set(colors: newValue)
}
}
@@ -156,12 +185,10 @@ public class KDCircularProgress: UIView {
@objc @IBInspectable private var IBColor2: UIColor?
@objc @IBInspectable private var IBColor3: UIColor?
private var animationCompletionBlock: ((Bool) -> Void)?
override public init(frame: CGRect) {
super.init(frame: frame)
userInteractionEnabled = false
setInitialValues()
refreshValues()
checkAndSetIBColors()
@@ -169,13 +196,12 @@ public class KDCircularProgress: UIView {
convenience public init(frame:CGRect, colors: UIColor...) {
self.init(frame: frame)
setColors(colors)
set(colors: colors)
}
required public init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
translatesAutoresizingMaskIntoConstraints = false
userInteractionEnabled = false
setInitialValues()
refreshValues()
}
@@ -184,7 +210,7 @@ public class KDCircularProgress: UIView {
checkAndSetIBColors()
}
override public class func layerClass() -> AnyClass {
override public class var layerClass: AnyClass {
return KDCircularProgressViewLayer.self
}
@@ -195,17 +221,18 @@ public class KDCircularProgress: UIView {
private func setInitialValues() {
radius = (frame.size.width/2.0) * 0.8 //We always apply a 20% padding, stopping glows from being clipped
backgroundColor = .clearColor()
setColors(UIColor.whiteColor(), UIColor.redColor())
backgroundColor = .clear
set(colors: .white, .cyan)
}
private func refreshValues() {
progressLayer.angle = angle
progressLayer.startAngle = UtilityFunctions.Mod(startAngle, range: 360, minMax: (0,360))
progressLayer.startAngle = startAngle
progressLayer.clockwise = clockwise
progressLayer.roundedCorners = roundedCorners
progressLayer.lerpColorMode = lerpColorMode
progressLayer.gradientRotateSpeed = gradientRotateSpeed
progressLayer.glowAmount = UtilityFunctions.Clamp(glowAmount, minMax: (0, 1))
progressLayer.glowAmount = glowAmount
progressLayer.glowMode = glowMode
progressLayer.progressThickness = progressThickness/2
progressLayer.trackColor = trackColor
@@ -213,32 +240,32 @@ public class KDCircularProgress: UIView {
}
private func checkAndSetIBColors() {
let nonNilColors = [IBColor1, IBColor2, IBColor3].filter { $0 != nil}.map { $0! }
if nonNilColors.count > 0 {
setColors(nonNilColors)
let nonNilColors = [IBColor1, IBColor2, IBColor3].flatMap { $0 }
if !nonNilColors.isEmpty {
set(colors: nonNilColors)
}
}
public func setColors(colors: UIColor...) {
setColors(colors)
public func set(colors: UIColor...) {
set(colors: colors)
}
private func setColors(colors: [UIColor]) {
private func set(colors: [UIColor]) {
progressLayer.colorsArray = colors
progressLayer.setNeedsDisplay()
}
public func animateFromAngle(fromAngle: Int, toAngle: Int, duration: NSTimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?) {
public func animate(fromAngle: Double, toAngle: Double, duration: TimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?) {
if isAnimating() {
pauseAnimation()
}
let animationDuration: NSTimeInterval
let animationDuration: TimeInterval
if relativeDuration {
animationDuration = duration
} else {
let traveledAngle = UtilityFunctions.Mod(toAngle - fromAngle, range: 360, minMax: (0, 360))
let scaledDuration = (NSTimeInterval(traveledAngle) * duration) / 360
let traveledAngle = Utility.mod(value: toAngle - fromAngle, range: 360, minMax: (0, 360))
let scaledDuration = (TimeInterval(traveledAngle) * duration) / 360
animationDuration = scaledDuration
}
@@ -247,24 +274,25 @@ public class KDCircularProgress: UIView {
animation.toValue = toAngle
animation.duration = animationDuration
animation.delegate = self
animation.isRemovedOnCompletion = false
angle = toAngle
animationCompletionBlock = completion
progressLayer.addAnimation(animation, forKey: "angle")
progressLayer.add(animation, forKey: "angle")
}
public func animateToAngle(toAngle: Int, duration: NSTimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?) {
public func animate(toAngle: Double, duration: TimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?) {
if isAnimating() {
pauseAnimation()
}
animateFromAngle(angle, toAngle: toAngle, duration: duration, relativeDuration: relativeDuration, completion: completion)
animate(fromAngle: angle, toAngle: toAngle, duration: duration, relativeDuration: relativeDuration, completion: completion)
}
public func pauseAnimation() {
let presentationLayer = progressLayer.presentationLayer() as! KDCircularProgressViewLayer
guard let presentationLayer = progressLayer.presentation() else { return }
let currentValue = presentationLayer.angle
progressLayer.removeAllAnimations()
animationCompletionBlock = nil
angle = currentValue
}
@@ -274,13 +302,13 @@ public class KDCircularProgress: UIView {
}
public func isAnimating() -> Bool {
return progressLayer.animationForKey("angle") != nil
return progressLayer.animation(forKey: "angle") != nil
}
override public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
if let completionBlock = animationCompletionBlock {
completionBlock(flag)
animationCompletionBlock = nil
completionBlock(flag)
}
}
@@ -290,7 +318,7 @@ public class KDCircularProgress: UIView {
}
}
public override func willMoveToSuperview(newSuperview: UIView?) {
public override func willMove(toSuperview newSuperview: UIView?) {
if newSuperview == nil && isAnimating() {
pauseAnimation()
}
@@ -304,49 +332,50 @@ public class KDCircularProgress: UIView {
}
private class KDCircularProgressViewLayer: CALayer {
@NSManaged var angle: Int
var radius: CGFloat! {
@NSManaged var angle: Double
var radius: CGFloat = 0 {
didSet {
invalidateGradientCache()
}
}
var startAngle: Int!
var clockwise: Bool! {
var startAngle: Double = 0
var clockwise: Bool = true {
didSet {
if clockwise != oldValue {
invalidateGradientCache()
}
}
}
var roundedCorners: Bool!
var gradientRotateSpeed: CGFloat! {
var roundedCorners: Bool = true
var lerpColorMode: Bool = false
var gradientRotateSpeed: CGFloat = 0 {
didSet {
invalidateGradientCache()
}
}
var glowAmount: CGFloat!
var glowMode: KDCircularProgressGlowMode!
var progressThickness: CGFloat!
var trackThickness: CGFloat!
var trackColor: UIColor!
var progressInsideFillColor: UIColor = UIColor.clearColor()
var colorsArray: [UIColor]! {
var glowAmount: CGFloat = 0
var glowMode: KDCircularProgressGlowMode = .forward
var progressThickness: CGFloat = 0.5
var trackThickness: CGFloat = 0.5
var trackColor: UIColor = .black
var progressInsideFillColor: UIColor = .clear
var colorsArray: [UIColor] = [] {
didSet {
invalidateGradientCache()
}
}
private var gradientCache: CGGradientRef?
private var gradientCache: CGGradient?
private var locationsCache: [CGFloat]?
private struct GlowConstants {
private enum GlowConstants {
private static let sizeToGlowRatio: CGFloat = 0.00015
static func glowAmountForAngle(angle: Int, glowAmount: CGFloat, glowMode: KDCircularProgressGlowMode, size: CGFloat) -> CGFloat {
static func glowAmount(forAngle angle: Double, glowAmount: CGFloat, glowMode: KDCircularProgressGlowMode, size: CGFloat) -> CGFloat {
switch glowMode {
case .Forward:
case .forward:
return CGFloat(angle) * size * sizeToGlowRatio * glowAmount
case .Reverse:
case .reverse:
return CGFloat(360 - angle) * size * sizeToGlowRatio * glowAmount
case .Constant:
case .constant:
return 360 * size * sizeToGlowRatio * glowAmount
default:
return 0
@@ -354,11 +383,11 @@ public class KDCircularProgress: UIView {
}
}
override class func needsDisplayForKey(key: String) -> Bool {
return key == "angle" ? true : super.needsDisplayForKey(key)
override class func needsDisplay(forKey key: String) -> Bool {
return key == "angle" ? true : super.needsDisplay(forKey: key)
}
override init(layer: AnyObject) {
override init(layer: Any) {
super.init(layer: layer)
let progressLayer = layer as! KDCircularProgressViewLayer
radius = progressLayer.radius
@@ -366,6 +395,7 @@ public class KDCircularProgress: UIView {
startAngle = progressLayer.startAngle
clockwise = progressLayer.clockwise
roundedCorners = progressLayer.roundedCorners
lerpColorMode = progressLayer.lerpColorMode
gradientRotateSpeed = progressLayer.gradientRotateSpeed
glowAmount = progressLayer.glowAmount
glowMode = progressLayer.glowMode
@@ -384,114 +414,140 @@ public class KDCircularProgress: UIView {
super.init(coder: aDecoder)
}
override func drawInContext(ctx: CGContext) {
override func draw(in ctx: CGContext) {
UIGraphicsPushContext(ctx)
let rect = bounds
let size = rect.size
let trackLineWidth: CGFloat = radius * trackThickness
let size = bounds.size
let width = size.width
let height = size.height
let trackLineWidth = radius * trackThickness
let progressLineWidth = radius * progressThickness
let arcRadius = max(radius - trackLineWidth/2, radius - progressLineWidth/2)
CGContextAddArc(ctx, CGFloat(size.width/2.0), CGFloat(size.height/2.0), arcRadius, 0, CGFloat(M_PI * 2), 0)
ctx.addArc(center: CGPoint(x: width/2.0, y: height/2.0), radius: arcRadius, startAngle: 0, endAngle: CGFloat.pi * 2, clockwise: false)
trackColor.set()
CGContextSetStrokeColorWithColor(ctx, trackColor.CGColor)
CGContextSetFillColorWithColor(ctx, progressInsideFillColor.CGColor)
CGContextSetLineWidth(ctx, trackLineWidth)
CGContextSetLineCap(ctx, CGLineCap.Butt)
CGContextDrawPath(ctx, .FillStroke)
ctx.setStrokeColor(trackColor.cgColor)
ctx.setFillColor(progressInsideFillColor.cgColor)
ctx.setLineWidth(trackLineWidth)
ctx.setLineCap(CGLineCap.butt)
ctx.drawPath(using: .fillStroke)
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
let imageCtx = UIGraphicsGetCurrentContext()
let reducedAngle = UtilityFunctions.Mod(angle, range: 360, minMax: (0, 360))
let fromAngle = ConversionFunctions.DegreesToRadians(CGFloat(-startAngle))
let toAngle = ConversionFunctions.DegreesToRadians(CGFloat((clockwise == true ? -reducedAngle : reducedAngle) - startAngle))
CGContextAddArc(imageCtx, CGFloat(size.width/2.0),CGFloat(size.height/2.0), arcRadius, fromAngle, toAngle, clockwise == true ? 1 : 0)
let glowValue = GlowConstants.glowAmountForAngle(reducedAngle, glowAmount: glowAmount, glowMode: glowMode, size: size.width)
if glowValue > 0 {
CGContextSetShadowWithColor(imageCtx, CGSizeZero, glowValue, UIColor.blackColor().CGColor)
}
CGContextSetLineCap(imageCtx, roundedCorners == true ? .Round : .Butt)
CGContextSetLineWidth(imageCtx, progressLineWidth)
CGContextDrawPath(imageCtx, .Stroke)
let drawMask: CGImageRef = CGBitmapContextCreateImage(UIGraphicsGetCurrentContext())!
let imageCtx = UIGraphicsGetCurrentContext()
let reducedAngle = Utility.mod(value: angle, range: 360, minMax: (0, 360))
let fromAngle = Conversion.degreesToRadians(value: CGFloat(-startAngle))
let toAngle = Conversion.degreesToRadians(value: CGFloat((clockwise == true ? -reducedAngle : reducedAngle) - startAngle))
imageCtx?.addArc(center: CGPoint(x: width/2.0, y: height/2.0), radius: arcRadius, startAngle: fromAngle, endAngle: toAngle, clockwise: clockwise)
let glowValue = GlowConstants.glowAmount(forAngle: reducedAngle, glowAmount: glowAmount, glowMode: glowMode, size: width)
if glowValue > 0 {
imageCtx?.setShadow(offset: CGSize.zero, blur: glowValue, color: UIColor.black.cgColor)
}
let linecap: CGLineCap = roundedCorners == true ? .round : .butt
imageCtx?.setLineCap(linecap)
imageCtx?.setLineWidth(progressLineWidth)
imageCtx?.drawPath(using: .stroke)
let drawMask: CGImage = UIGraphicsGetCurrentContext()!.makeImage()!
UIGraphicsEndImageContext()
CGContextSaveGState(ctx)
CGContextClipToMask(ctx, bounds, drawMask)
ctx.saveGState()
ctx.clip(to: bounds, mask: drawMask)
//Gradient - Fill
if colorsArray.count > 1 {
var componentsArray: [CGFloat] = []
let rgbColorsArray: [UIColor] = colorsArray.map {c in // Make sure every color in colors array is in RGB color space
if CGColorGetNumberOfComponents(c.CGColor) == 2 {
let whiteValue = CGColorGetComponents(c.CGColor)[0]
return UIColor(red: whiteValue, green: whiteValue, blue: whiteValue, alpha: 1.0)
if !lerpColorMode && colorsArray.count > 1 {
let rgbColorsArray: [UIColor] = colorsArray.map { color in // Make sure every color in colors array is in RGB color space
if color.cgColor.numberOfComponents == 2 {
if let whiteValue = color.cgColor.components?[0] {
return UIColor(red: whiteValue, green: whiteValue, blue: whiteValue, alpha: 1.0)
} else {
return UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
}
} else {
return c
return color
}
}
for color in rgbColorsArray {
let colorComponents: UnsafePointer<CGFloat> = CGColorGetComponents(color.CGColor)
componentsArray.appendContentsOf([colorComponents[0],colorComponents[1],colorComponents[2],1.0])
let componentsArray = rgbColorsArray.flatMap { color -> [CGFloat] in
guard let components = color.cgColor.components else { return [] }
return [components[0], components[1], components[2], 1.0]
}
drawGradientWithContext(ctx, componentsArray: componentsArray)
drawGradientWith(context: ctx, componentsArray: componentsArray)
} else {
if colorsArray.count == 1 {
fillRectWithContext(ctx, color: colorsArray[0])
var color: UIColor?
if colorsArray.isEmpty {
color = UIColor.white
} else if colorsArray.count == 1 {
color = colorsArray[0]
} else {
fillRectWithContext(ctx, color: UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0))
// lerpColorMode is true
let t = CGFloat(reducedAngle) / 360
let steps = colorsArray.count - 1
let step = 1 / CGFloat(steps)
for i in 1...steps {
let fi = CGFloat(i)
if (t <= fi * step || i == steps) {
let colorT = Utility.inverseLerp(value: t, minMax: ((fi - 1) * step, fi * step))
color = Utility.colorLerp(value: colorT, minMax: (colorsArray[i - 1], colorsArray[i]))
break
}
}
}
if let color = color {
fillRectWith(context: ctx, color: color)
}
}
CGContextRestoreGState(ctx)
ctx.restoreGState()
UIGraphicsPopContext()
}
private func fillRectWithContext(ctx: CGContext!, color: UIColor) {
CGContextSetFillColorWithColor(ctx, color.CGColor)
CGContextFillRect(ctx, bounds)
private func fillRectWith(context: CGContext!, color: UIColor) {
context.setFillColor(color.cgColor)
context.fill(bounds)
}
private func drawGradientWithContext(ctx: CGContext!, componentsArray: [CGFloat]) {
private func drawGradientWith(context: CGContext!, componentsArray: [CGFloat]) {
let baseSpace = CGColorSpaceCreateDeviceRGB()
let locations = locationsCache ?? gradientLocationsFromColorCount(componentsArray.count/4, gradientWidth: bounds.size.width)
let locations = locationsCache ?? gradientLocationsFor(colorCount: componentsArray.count/4, gradientWidth: bounds.size.width)
let gradient: CGGradient
if let g = self.gradientCache {
gradient = g
if let cachedGradient = gradientCache {
gradient = cachedGradient
} else {
guard let g = CGGradientCreateWithColorComponents(baseSpace, componentsArray, locations,componentsArray.count / 4) else { return }
self.gradientCache = g
gradient = g
guard let cachedGradient = CGGradient(colorSpace: baseSpace, colorComponents: componentsArray, locations: locations, count: componentsArray.count/4) else {
return
}
gradientCache = cachedGradient
gradient = cachedGradient
}
let halfX = bounds.size.width/2.0
let floatPi = CGFloat(M_PI)
let halfX = bounds.size.width / 2.0
let floatPi = CGFloat.pi
let rotateSpeed = clockwise == true ? gradientRotateSpeed : gradientRotateSpeed * -1
let angleInRadians = ConversionFunctions.DegreesToRadians(rotateSpeed * CGFloat(angle) - 90)
let angleInRadians = Conversion.degreesToRadians(value: rotateSpeed * CGFloat(angle) - 90)
let oppositeAngle = angleInRadians > floatPi ? angleInRadians - floatPi : angleInRadians + floatPi
let startPoint = CGPoint(x: (cos(angleInRadians) * halfX) + halfX, y: (sin(angleInRadians) * halfX) + halfX)
let endPoint = CGPoint(x: (cos(oppositeAngle) * halfX) + halfX, y: (sin(oppositeAngle) * halfX) + halfX)
CGContextDrawLinearGradient(ctx, gradient, startPoint, endPoint, .DrawsBeforeStartLocation)
context.drawLinearGradient(gradient, start: startPoint, end: endPoint, options: .drawsBeforeStartLocation)
}
private func gradientLocationsFromColorCount(colorCount: Int, gradientWidth: CGFloat) -> [CGFloat] {
private func gradientLocationsFor(colorCount: Int, gradientWidth: CGFloat) -> [CGFloat] {
if colorCount == 0 || gradientWidth == 0 {
return []
} else {
var locationsArray: [CGFloat] = []
let progressLineWidth = radius * progressThickness
let firstPoint = gradientWidth/2 - (radius - progressLineWidth/2)
let increment = (gradientWidth - (2*firstPoint))/CGFloat(colorCount - 1)
for i in 0..<colorCount {
locationsArray.append(firstPoint + (CGFloat(i) * increment))
}
assert(locationsArray.count == colorCount, "color counts should be equal")
let locationsArray = (0..<colorCount).map { firstPoint + (CGFloat($0) * increment) }
let result = locationsArray.map { $0 / gradientWidth }
locationsCache = result
return result
@@ -1,436 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
BC9E758C1A8CE4A500B1DF3D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9E758B1A8CE4A500B1DF3D /* AppDelegate.swift */; };
BC9E758E1A8CE4A500B1DF3D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9E758D1A8CE4A500B1DF3D /* ViewController.swift */; };
BC9E75911A8CE4A500B1DF3D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BC9E758F1A8CE4A500B1DF3D /* Main.storyboard */; };
BC9E75931A8CE4A500B1DF3D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BC9E75921A8CE4A500B1DF3D /* Images.xcassets */; };
BC9E75961A8CE4A500B1DF3D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC9E75941A8CE4A500B1DF3D /* LaunchScreen.xib */; };
BC9E75A21A8CE4A500B1DF3D /* KDCircularProgressExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9E75A11A8CE4A500B1DF3D /* KDCircularProgressExampleTests.swift */; };
BC9E75AD1A8CE4CC00B1DF3D /* KDCircularProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9E75AC1A8CE4CC00B1DF3D /* KDCircularProgress.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
BC9E759C1A8CE4A500B1DF3D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BC9E757E1A8CE4A500B1DF3D /* Project object */;
proxyType = 1;
remoteGlobalIDString = BC9E75851A8CE4A500B1DF3D;
remoteInfo = KDCircularProgressExample;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
BC9E75861A8CE4A500B1DF3D /* KDCircularProgressExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KDCircularProgressExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
BC9E758A1A8CE4A500B1DF3D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BC9E758B1A8CE4A500B1DF3D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
BC9E758D1A8CE4A500B1DF3D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
BC9E75901A8CE4A500B1DF3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
BC9E75921A8CE4A500B1DF3D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
BC9E75951A8CE4A500B1DF3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
BC9E759B1A8CE4A500B1DF3D /* KDCircularProgressExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KDCircularProgressExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
BC9E75A01A8CE4A500B1DF3D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BC9E75A11A8CE4A500B1DF3D /* KDCircularProgressExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KDCircularProgressExampleTests.swift; sourceTree = "<group>"; };
BC9E75AC1A8CE4CC00B1DF3D /* KDCircularProgress.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = KDCircularProgress.swift; path = ../KDCircularProgress/KDCircularProgress.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
BC9E75831A8CE4A500B1DF3D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
BC9E75981A8CE4A500B1DF3D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
BC9E757D1A8CE4A500B1DF3D = {
isa = PBXGroup;
children = (
BC9E75881A8CE4A500B1DF3D /* KDCircularProgressExample */,
BC9E759E1A8CE4A500B1DF3D /* KDCircularProgressExampleTests */,
BC9E75871A8CE4A500B1DF3D /* Products */,
);
sourceTree = "<group>";
};
BC9E75871A8CE4A500B1DF3D /* Products */ = {
isa = PBXGroup;
children = (
BC9E75861A8CE4A500B1DF3D /* KDCircularProgressExample.app */,
BC9E759B1A8CE4A500B1DF3D /* KDCircularProgressExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
BC9E75881A8CE4A500B1DF3D /* KDCircularProgressExample */ = {
isa = PBXGroup;
children = (
BC9E75AB1A8CE4B000B1DF3D /* KDCircularProgress */,
BC9E758B1A8CE4A500B1DF3D /* AppDelegate.swift */,
BC9E758D1A8CE4A500B1DF3D /* ViewController.swift */,
BC9E758F1A8CE4A500B1DF3D /* Main.storyboard */,
BC9E75921A8CE4A500B1DF3D /* Images.xcassets */,
BC9E75941A8CE4A500B1DF3D /* LaunchScreen.xib */,
BC9E75891A8CE4A500B1DF3D /* Supporting Files */,
);
path = KDCircularProgressExample;
sourceTree = "<group>";
};
BC9E75891A8CE4A500B1DF3D /* Supporting Files */ = {
isa = PBXGroup;
children = (
BC9E758A1A8CE4A500B1DF3D /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
BC9E759E1A8CE4A500B1DF3D /* KDCircularProgressExampleTests */ = {
isa = PBXGroup;
children = (
BC9E75A11A8CE4A500B1DF3D /* KDCircularProgressExampleTests.swift */,
BC9E759F1A8CE4A500B1DF3D /* Supporting Files */,
);
path = KDCircularProgressExampleTests;
sourceTree = "<group>";
};
BC9E759F1A8CE4A500B1DF3D /* Supporting Files */ = {
isa = PBXGroup;
children = (
BC9E75A01A8CE4A500B1DF3D /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
BC9E75AB1A8CE4B000B1DF3D /* KDCircularProgress */ = {
isa = PBXGroup;
children = (
BC9E75AC1A8CE4CC00B1DF3D /* KDCircularProgress.swift */,
);
name = KDCircularProgress;
path = ..;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
BC9E75851A8CE4A500B1DF3D /* KDCircularProgressExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = BC9E75A51A8CE4A500B1DF3D /* Build configuration list for PBXNativeTarget "KDCircularProgressExample" */;
buildPhases = (
BC9E75821A8CE4A500B1DF3D /* Sources */,
BC9E75831A8CE4A500B1DF3D /* Frameworks */,
BC9E75841A8CE4A500B1DF3D /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = KDCircularProgressExample;
productName = KDCircularProgressExample;
productReference = BC9E75861A8CE4A500B1DF3D /* KDCircularProgressExample.app */;
productType = "com.apple.product-type.application";
};
BC9E759A1A8CE4A500B1DF3D /* KDCircularProgressExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = BC9E75A81A8CE4A500B1DF3D /* Build configuration list for PBXNativeTarget "KDCircularProgressExampleTests" */;
buildPhases = (
BC9E75971A8CE4A500B1DF3D /* Sources */,
BC9E75981A8CE4A500B1DF3D /* Frameworks */,
BC9E75991A8CE4A500B1DF3D /* Resources */,
);
buildRules = (
);
dependencies = (
BC9E759D1A8CE4A500B1DF3D /* PBXTargetDependency */,
);
name = KDCircularProgressExampleTests;
productName = KDCircularProgressExampleTests;
productReference = BC9E759B1A8CE4A500B1DF3D /* KDCircularProgressExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
BC9E757E1A8CE4A500B1DF3D /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = "Kaan Dedeoglu";
TargetAttributes = {
BC9E75851A8CE4A500B1DF3D = {
CreatedOnToolsVersion = 6.1.1;
};
BC9E759A1A8CE4A500B1DF3D = {
CreatedOnToolsVersion = 6.1.1;
TestTargetID = BC9E75851A8CE4A500B1DF3D;
};
};
};
buildConfigurationList = BC9E75811A8CE4A500B1DF3D /* Build configuration list for PBXProject "KDCircularProgressExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = BC9E757D1A8CE4A500B1DF3D;
productRefGroup = BC9E75871A8CE4A500B1DF3D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
BC9E75851A8CE4A500B1DF3D /* KDCircularProgressExample */,
BC9E759A1A8CE4A500B1DF3D /* KDCircularProgressExampleTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
BC9E75841A8CE4A500B1DF3D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BC9E75911A8CE4A500B1DF3D /* Main.storyboard in Resources */,
BC9E75961A8CE4A500B1DF3D /* LaunchScreen.xib in Resources */,
BC9E75931A8CE4A500B1DF3D /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BC9E75991A8CE4A500B1DF3D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
BC9E75821A8CE4A500B1DF3D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BC9E75AD1A8CE4CC00B1DF3D /* KDCircularProgress.swift in Sources */,
BC9E758E1A8CE4A500B1DF3D /* ViewController.swift in Sources */,
BC9E758C1A8CE4A500B1DF3D /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BC9E75971A8CE4A500B1DF3D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BC9E75A21A8CE4A500B1DF3D /* KDCircularProgressExampleTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
BC9E759D1A8CE4A500B1DF3D /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BC9E75851A8CE4A500B1DF3D /* KDCircularProgressExample */;
targetProxy = BC9E759C1A8CE4A500B1DF3D /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
BC9E758F1A8CE4A500B1DF3D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
BC9E75901A8CE4A500B1DF3D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
BC9E75941A8CE4A500B1DF3D /* LaunchScreen.xib */ = {
isa = PBXVariantGroup;
children = (
BC9E75951A8CE4A500B1DF3D /* Base */,
);
name = LaunchScreen.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
BC9E75A31A8CE4A500B1DF3D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
BC9E75A41A8CE4A500B1DF3D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
BC9E75A61A8CE4A500B1DF3D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = KDCircularProgressExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
BC9E75A71A8CE4A500B1DF3D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = KDCircularProgressExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
BC9E75A91A8CE4A500B1DF3D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = KDCircularProgressExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KDCircularProgressExample.app/KDCircularProgressExample";
};
name = Debug;
};
BC9E75AA1A8CE4A500B1DF3D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = KDCircularProgressExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KDCircularProgressExample.app/KDCircularProgressExample";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
BC9E75811A8CE4A500B1DF3D /* Build configuration list for PBXProject "KDCircularProgressExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BC9E75A31A8CE4A500B1DF3D /* Debug */,
BC9E75A41A8CE4A500B1DF3D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BC9E75A51A8CE4A500B1DF3D /* Build configuration list for PBXNativeTarget "KDCircularProgressExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BC9E75A61A8CE4A500B1DF3D /* Debug */,
BC9E75A71A8CE4A500B1DF3D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BC9E75A81A8CE4A500B1DF3D /* Build configuration list for PBXNativeTarget "KDCircularProgressExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BC9E75A91A8CE4A500B1DF3D /* Debug */,
BC9E75AA1A8CE4A500B1DF3D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = BC9E757E1A8CE4A500B1DF3D /* Project object */;
}
@@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC9E75851A8CE4A500B1DF3D"
BuildableName = "KDCircularProgressExample.app"
BlueprintName = "KDCircularProgressExample"
ReferencedContainer = "container:KDCircularProgressExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC9E759A1A8CE4A500B1DF3D"
BuildableName = "KDCircularProgressExampleTests.xctest"
BlueprintName = "KDCircularProgressExampleTests"
ReferencedContainer = "container:KDCircularProgressExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC9E759A1A8CE4A500B1DF3D"
BuildableName = "KDCircularProgressExampleTests.xctest"
BlueprintName = "KDCircularProgressExampleTests"
ReferencedContainer = "container:KDCircularProgressExample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC9E75851A8CE4A500B1DF3D"
BuildableName = "KDCircularProgressExample.app"
BlueprintName = "KDCircularProgressExample"
ReferencedContainer = "container:KDCircularProgressExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC9E75851A8CE4A500B1DF3D"
BuildableName = "KDCircularProgressExample.app"
BlueprintName = "KDCircularProgressExample"
ReferencedContainer = "container:KDCircularProgressExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BC9E75851A8CE4A500B1DF3D"
BuildableName = "KDCircularProgressExample.app"
BlueprintName = "KDCircularProgressExample"
ReferencedContainer = "container:KDCircularProgressExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 Kaan Dedeoglu. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="KDCircularProgressExample" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
@@ -1,36 +0,0 @@
//
// KDCircularProgressExampleTests.swift
// KDCircularProgressExampleTests
//
// Created by Kaan Dedeoglu on 2/12/15.
// Copyright (c) 2015 Kaan Dedeoglu. All rights reserved.
//
import UIKit
import XCTest
class KDCircularProgressExampleTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
XCTAssert(true, "Pass")
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Kaan Dedeoglu
Copyright (c) 2016 Kaan Dedeoglu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+91 -57
View File
@@ -1,89 +1,133 @@
# KDCircularProgress
`KDCircularProgress` is a circular progress view written in Swift. It makes it possible to have gradients in the progress view, along with glows and animations.
[![Version](https://img.shields.io/cocoapods/v/KDCircularProgress.svg?style=flat)](http://cocoapods.org/pods/KDCircularProgress)
[![License](https://img.shields.io/cocoapods/l/KDCircularProgress.svg?style=flat)](http://cocoapods.org/pods/KDCircularProgress)
[![Platform](https://img.shields.io/cocoapods/p/KDCircularProgress.svg?style=flat)](http://cocoapods.org/pods/KDCircularProgress)
>
`KDCircularProgress` master branch is now compatible with Swift 3 (tag 1.5.2). Check Swift 2 (tag 1.4.1) & Swift 2.3 (tag 1.4.5) branches for older versions.
`KDCircularProgress` is a circular progress view written in Swift. It makes it possible to have gradients in the progress view, along with glows and animations.
KDCircularProgress also has `IBInspectable` and `IBDesignable` support, so you can configure and preview inside the `Interface Builder`.
Here's an example
[Youtube Link](http://youtu.be/iIdas72MXOg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot.gif)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/Assets/screenshot.gif)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot.png)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot2.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot3.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot4.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot5.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot6.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot7.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/Assets/screenshot.png)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/Assets/screenshot2.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/Assets/screenshot3.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/Assets/screenshot4.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/Assets/screenshot5.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/Assets/screenshot6.jpg)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/Assets/screenshot7.jpg)
## Requirements
`KDCircularProgress` requires iOS 8+, although iOS 8 support hasn't been tested in a while.
## Installation
- It's on CocoaPods under the name (you guessed it!) KDCircularProgress
- Just drag `KDCircularProgress.swift` into your project. `Carthage` support is on To-do list.
### CocoaPods
KDCircularProgress is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```bash
pod 'KDCircularProgress'
```
then run
```bash
$ pod install
```
### Carthage
Add the line `github "kaandedeoglu/KDCircularProgress"` to your `Cartfile` and then run the command:
```bash
carthage update
```
### Manually
Just drag `KDCircularProgress.swift` into your project.
## Sample Code
Below you can see code that creates and sets up a `KCircularProgress` instance. Which gives you a configuration that looks similar to the progress in the example images.
```swift
let progress = KDCircularProgress(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
progress = KDCircularProgress(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
progress.startAngle = -90
progress.progressThickness = 0.2
progress.trackThickness = 0.7
progress.trackThickness = 0.6
progress.clockwise = true
progress.center = view.center
progress.gradientRotateSpeed = 2
progress.roundedCorners = true
progress.glowMode = .Forward
progress.angle = 300
progress.setColors(UIColor.cyanColor() ,UIColor.whiteColor(), UIColor.magentaColor())
progress.roundedCorners = false
progress.glowMode = .forward
progress.glowAmount = 0.9
progress.set(colors: UIColor.cyan ,UIColor.white, UIColor.magenta, UIColor.white, UIColor.orange)
progress.center = CGPoint(x: view.center.x, y: view.center.y + 25)
view.addSubview(progress)
```
## Installation
- It's on Cocoapods under the name (you guessed it!) KDCircularProgress
- Just drag `KDCircularProgress.swift` into your project. `Carthage` support is on To-do list.
## Properties
####progressColors: `[UIColor]`
#### progressColors: `[UIColor]`
The colors used to generate the gradient of the progress. You can also set this using the variadic `setColors(UIColor...)` method. A gradient is used only if there is more than one color. A fill is used otherwise. The default is a white fill.
####angle: `Int`
#### angle: `Int`
The angle of the progress. Between 0 and 360 (inclusive). Simply change its value in order to change the visual progress of the component. Default is 0.
####startAngle: `Int`
#### startAngle: `Int`
The angle at which the progress will begin. Between 0 and 360 (inclusive), however you can pass any negative or positive values and the component will mod them automatically to the required range. Default is 0.
####clockwise: `Bool`
#### clockwise: `Bool`
Clockwise if true, Counter-clockwise if false. Default is true.
####roundedCorners: `Bool`
#### roundedCorners: `Bool`
When true, the ends of the progress track will be drawn with a half circle radius. Default is false.
####gradientRotateSpeed: `CGFloat`
#### gradientRotateSpeed: `CGFloat`
Describes how many times the underlying gradient will perform a 2π rotation for each full cycle of the progress. Integer values recommended. Default is 0.
####glowAmount: `CGFloat`
#### glowAmount: `CGFloat`
The intensity of the glow. Between 0 and 1.0. Default is 1.0.
####glowMode: `KDCircularProgressGlowMode`
- **.Forward** - The glow increases proportionaly to the angle. No glow at 0 degrees and full glow at 360 degrees.
#### glowMode: `KDCircularProgressGlowMode`
- **.forward** - The glow increases proportionaly to the angle. No glow at 0 degrees and full glow at 360 degrees.
- **.Reverse** - The glow increases inversely proportional to the angle. Full glow at 0 degrees and no glow at 360 degrees.
- **.reverse** - The glow increases inversely proportional to the angle. Full glow at 0 degrees and no glow at 360 degrees.
- **.Constant** - Constant glow.
- **.constant** - Constant glow.
- **.NoGlow** - No glow
- **.noGlow** - No glow
The default is **.Forward**
The default is **.forward**
####progressThickness: `CGFloat`
#### progressThickness: `CGFloat`
The thickness of the progress. Between 0 and 1. Default is 0.4
####trackThickness: `CGFloat`
#### trackThickness: `CGFloat`
The thickness of the background track. Between 0 and 1. Default is 0.5
####trackColor: `UIColor`
#### trackColor: `UIColor`
The color of the background track. Default is `UIColor.blackColor()`.
####progressInsideFillColor: `UIColor`
#### progressInsideFillColor: `UIColor`
The color of the center of the circle. Default is `UIColor.clearColor()`.
##Methods
## Methods
```swift
override public init(frame: CGRect)
```
@@ -95,58 +139,48 @@ convenience public init(frame:CGRect, colors: UIColor...)
Initialize with a frame and the gradient colors.
```swift
public func setColors(colors: UIColor...)
public func set(colors: UIColor...)
public func set(colors: [UIColor])
```
Set the colors for the progress gradient.
```swift
public func animateFromAngle(fromAngle: Int, toAngle: Int, duration: NSTimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?)
```
Animate the progress from an initial value to a final value, with a completion block that fires after the animation is done.
`relativeDuration` - specify if the duration is for the specific animation or is the duration that would make a full turn.
```swift
public func animateToAngle(toAngle: Int, duration: NSTimeInterval, completion: ((Bool) -> Void)?)
```
Animate the progress from the current state to a target value.
```swift
public func pauseAnimation()
```
Pause the animation, if any.
```swift
public func isAnimating() -> Bool
```
Check if there's an active animation.
##Misc
## Misc
Prefering light colors in the gradients gives better results. As mentioned before, use square frames. Rectangular frames are not tested and might produce unexpected results.
##To-Do
- [x] Add example project
- [ ] Carthage Support
- [x] Cocoapods Support
- [x] IBDesignable/IBInspectable support
- [ ] Adding a `progress` property as an alternative to `angle`
- [ ] Clean up
##Contact
## Contact
Drop me an email if you want discuss anything further.
[Email](kaandedeoglu@me.com)
##License
## License
The MIT License (MIT)
Copyright (c) 2015 Kaan Dedeoglu
Copyright (c) 2017 Kaan Dedeoglu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal