3 Commits

Author SHA1 Message Date
Kaan Dedeoglu fb5f616d82 Merge pull request #39 from pakmee/swift2.3
converted to swift 2.3 and fixed auto correct with context
2016-09-06 18:50:21 +03:00
Jonathan Siao aa4edacabf cleaned spaces 2016-09-05 14:09:57 +04:00
Jonathan Siao 6475bc0a58 converted to swift 2.3 and fixed auto correct with context 2016-09-05 14:02:15 +04:00
30 changed files with 867 additions and 1062 deletions
+10 -23
View File
@@ -1,13 +1,6 @@
# Mac OS X
.DS_Store
# Xcode
## Build generated
#
build/
DerivedData
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
@@ -17,23 +10,17 @@ DerivedData
*.perspectivev3
!default.perspectivev3
xcuserdata
## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint
## Obj-C/Swift specific
DerivedData
*.hmap
*.ipa
*.xcuserstate
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
.build/
# Carthage
Carthage/Build
# 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/
-1
View File
@@ -1 +0,0 @@
3.0
@@ -1,341 +0,0 @@
// !$*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,27 +0,0 @@
<?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 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KDCircularProgress'
s.version = '1.5.2'
s.version = '1.4.1'
s.license = 'MIT'
s.summary = 'A circular progress view with gradients written in Swift'
s.homepage = 'https://github.com/kaandedeoglu/KDCircularProgress'
@@ -1,305 +0,0 @@
// !$*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 */;
}
@@ -1,80 +0,0 @@
<?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
@@ -1,10 +0,0 @@
<?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>
-19
View File
@@ -1,19 +0,0 @@
//
// 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>
+131 -125
View File
@@ -9,19 +9,23 @@
import UIKit
public enum KDCircularProgressGlowMode {
case forward, reverse, constant, noGlow
case Forward, Reverse, Constant, NoGlow
}
@IBDesignable
public class KDCircularProgress: UIView, CAAnimationDelegate {
public class KDCircularProgress: UIView,CAAnimationDelegate {
private enum Conversion {
private struct Conversion {
static func degreesToRadians (value:CGFloat) -> CGFloat {
return value * CGFloat.pi / 180.0
return value * CGFloat(M_PI) / 180.0
}
static func radiansToDegrees (value:CGFloat) -> CGFloat {
return value * 180.0 / CGFloat(M_PI)
}
}
private enum Utility {
private struct Utility {
static func clamp<T: Comparable>(value: T, minMax: (T, T)) -> T {
let (min, max) = minMax
if value < min {
@@ -42,9 +46,9 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
}
static func colorLerp(value: CGFloat, minMax: (UIColor, UIColor)) -> UIColor {
let clampedValue = clamp(value: value, minMax: (0, 1))
let clampedValue = clamp(value, minMax: (0, 1))
let zero = CGFloat(0)
let zero: CGFloat = 0
var (r0, g0, b0, a0) = (zero, zero, zero, zero)
minMax.0.getRed(&r0, green: &g0, blue: &b0, alpha: &a0)
@@ -52,7 +56,7 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
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)))
return UIColor(red: lerp(clampedValue, minMax: (r0, r1)), green: lerp(clampedValue, minMax: (g0, g1)), blue: lerp(clampedValue, minMax: (b0, b1)), alpha: lerp(clampedValue, minMax: (a0, a1)))
}
static func mod(value: Double, range: Double, minMax: (Double, Double)) -> Double {
@@ -61,9 +65,9 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
if value >= min && value <= max {
return value
} else if value < min {
return mod(value: value + range, range: range, minMax: minMax)
return mod(value + range, range: range, minMax: minMax)
} else {
return mod(value: value - range, range: range, minMax: minMax)
return mod(value - range, range: range, minMax: minMax)
}
}
}
@@ -74,19 +78,12 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
}
}
private var radius: CGFloat = 0 {
private var radius: CGFloat! {
didSet {
progressLayer.radius = radius
}
}
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() {
@@ -98,7 +95,7 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
@IBInspectable public var startAngle: Double = 0 {
didSet {
startAngle = Utility.mod(value: startAngle, range: 360, minMax: (0, 360))
startAngle = Utility.mod(startAngle, range: 360, minMax: (0, 360))
progressLayer.startAngle = startAngle
progressLayer.setNeedsDisplay()
}
@@ -131,12 +128,12 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
@IBInspectable public var glowAmount: CGFloat = 1.0 {//Between 0 and 1
didSet {
glowAmount = Utility.clamp(value: glowAmount, minMax: (0, 1))
glowAmount = Utility.clamp(glowAmount, minMax: (0, 1))
progressLayer.glowAmount = glowAmount
}
}
@IBInspectable public var glowMode: KDCircularProgressGlowMode = .forward {
@IBInspectable public var glowMode: KDCircularProgressGlowMode = .Forward {
didSet {
progressLayer.glowMode = glowMode
}
@@ -144,19 +141,19 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
@IBInspectable public var progressThickness: CGFloat = 0.4 {//Between 0 and 1
didSet {
progressThickness = Utility.clamp(value: progressThickness, minMax: (0, 1))
progressThickness = Utility.clamp(progressThickness, minMax: (0, 1))
progressLayer.progressThickness = progressThickness/2
}
}
@IBInspectable public var trackThickness: CGFloat = 0.5 {//Between 0 and 1
didSet {
trackThickness = Utility.clamp(value: trackThickness, minMax: (0, 1))
trackThickness = Utility.clamp(trackThickness, minMax: (0, 1))
progressLayer.trackThickness = trackThickness/2
}
}
@IBInspectable public var trackColor: UIColor = .black {
@IBInspectable public var trackColor: UIColor = .blackColor() {
didSet {
progressLayer.trackColor = trackColor
progressLayer.setNeedsDisplay()
@@ -165,17 +162,21 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
@IBInspectable public var progressInsideFillColor: UIColor? = nil {
didSet {
progressLayer.progressInsideFillColor = progressInsideFillColor ?? .clear
if let color = progressInsideFillColor {
progressLayer.progressInsideFillColor = color
} else {
progressLayer.progressInsideFillColor = .clearColor()
}
}
}
@IBInspectable public var progressColors: [UIColor] {
@IBInspectable public var progressColors: [UIColor]! {
get {
return progressLayer.colorsArray
}
set {
set(colors: newValue)
set(newValue) {
setColors(newValue)
}
}
@@ -189,7 +190,7 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
override public init(frame: CGRect) {
super.init(frame: frame)
isUserInteractionEnabled = false
userInteractionEnabled = false
setInitialValues()
refreshValues()
checkAndSetIBColors()
@@ -197,13 +198,13 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
convenience public init(frame:CGRect, colors: UIColor...) {
self.init(frame: frame)
set(colors: colors)
setColors(colors)
}
required public init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
translatesAutoresizingMaskIntoConstraints = false
isUserInteractionEnabled = false
userInteractionEnabled = false
setInitialValues()
refreshValues()
}
@@ -212,7 +213,7 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
checkAndSetIBColors()
}
override public class var layerClass: AnyClass {
override public class func layerClass() -> AnyClass {
return KDCircularProgressViewLayer.self
}
@@ -223,8 +224,8 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
private func setInitialValues() {
radius = (frame.size.width/2.0) * 0.8 //We always apply a 20% padding, stopping glows from being clipped
backgroundColor = .clear
set(colors: .white, .cyan)
backgroundColor = .clearColor()
setColors(.whiteColor(), .cyanColor())
}
private func refreshValues() {
@@ -244,30 +245,30 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
private func checkAndSetIBColors() {
let nonNilColors = [IBColor1, IBColor2, IBColor3].flatMap { $0 }
if !nonNilColors.isEmpty {
set(colors: nonNilColors)
setColors(nonNilColors)
}
}
public func set(colors: UIColor...) {
set(colors: colors)
public func setColors(colors: UIColor...) {
setColors(colors)
}
private func set(colors: [UIColor]) {
private func setColors(colors: [UIColor]) {
progressLayer.colorsArray = colors
progressLayer.setNeedsDisplay()
}
public func animate(fromAngle: Double, toAngle: Double, duration: TimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?) {
public func animateFromAngle(fromAngle: Double, toAngle: Double, duration: NSTimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?) {
if isAnimating() {
pauseAnimation()
}
let animationDuration: TimeInterval
let animationDuration: NSTimeInterval
if relativeDuration {
animationDuration = duration
} else {
let traveledAngle = Utility.mod(value: toAngle - fromAngle, range: 360, minMax: (0, 360))
let scaledDuration = (TimeInterval(traveledAngle) * duration) / 360
let traveledAngle = Utility.mod(toAngle - fromAngle, range: 360, minMax: (0, 360))
let scaledDuration = (NSTimeInterval(traveledAngle) * duration) / 360
animationDuration = scaledDuration
}
@@ -279,36 +280,40 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
angle = toAngle
animationCompletionBlock = completion
progressLayer.add(animation, forKey: "angle")
progressLayer.addAnimation(animation, forKey: "angle")
}
public func animate(toAngle: Double, duration: TimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?) {
public func animateToAngle(toAngle: Double, duration: NSTimeInterval, relativeDuration: Bool = true, completion: ((Bool) -> Void)?) {
if isAnimating() {
pauseAnimation()
}
animate(fromAngle: angle, toAngle: toAngle, duration: duration, relativeDuration: relativeDuration, completion: completion)
animateFromAngle(angle, toAngle: toAngle, duration: duration, relativeDuration: relativeDuration, completion: completion)
}
public func pauseAnimation() {
guard let presentationLayer = progressLayer.presentation() else { return }
guard let presentationLayer = progressLayer.presentationLayer() else { return }
let currentValue = presentationLayer.angle
progressLayer.removeAllAnimations()
animationCompletionBlock = nil
angle = currentValue
}
public func stopAnimation() {
animationCompletionBlock = nil
progressLayer.removeAllAnimations()
angle = 0
}
public func isAnimating() -> Bool {
return progressLayer.animation(forKey: "angle") != nil
return progressLayer.animationForKey("angle") != nil
}
public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let completionBlock = animationCompletionBlock {
animationCompletionBlock = nil
if flag {
animationCompletionBlock = nil
}
completionBlock(flag)
}
}
@@ -319,7 +324,7 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
}
}
public override func willMove(toSuperview newSuperview: UIView?) {
public override func willMoveToSuperview(newSuperview: UIView?) {
if newSuperview == nil && isAnimating() {
pauseAnimation()
}
@@ -334,49 +339,49 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
private class KDCircularProgressViewLayer: CALayer {
@NSManaged var angle: Double
var radius: CGFloat = 0 {
var radius: CGFloat! {
didSet {
invalidateGradientCache()
}
}
var startAngle: Double = 0
var clockwise: Bool = true {
var startAngle: Double!
var clockwise: Bool! {
didSet {
if clockwise != oldValue {
invalidateGradientCache()
}
}
}
var roundedCorners: Bool = true
var lerpColorMode: Bool = false
var gradientRotateSpeed: CGFloat = 0 {
var roundedCorners: Bool!
var lerpColorMode: Bool!
var gradientRotateSpeed: CGFloat! {
didSet {
invalidateGradientCache()
}
}
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] = [] {
var glowAmount: CGFloat!
var glowMode: KDCircularProgressGlowMode!
var progressThickness: CGFloat!
var trackThickness: CGFloat!
var trackColor: UIColor!
var progressInsideFillColor: UIColor = UIColor.clearColor()
var colorsArray: [UIColor]! {
didSet {
invalidateGradientCache()
}
}
private var gradientCache: CGGradient?
private var gradientCache: CGGradientRef?
private var locationsCache: [CGFloat]?
private enum GlowConstants {
private struct GlowConstants {
private static let sizeToGlowRatio: CGFloat = 0.00015
static func glowAmount(forAngle angle: Double, glowAmount: CGFloat, glowMode: KDCircularProgressGlowMode, size: CGFloat) -> CGFloat {
static func glowAmountForAngle(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
@@ -384,11 +389,11 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
}
}
override class func needsDisplay(forKey key: String) -> Bool {
return key == "angle" ? true : super.needsDisplay(forKey: key)
override class func needsDisplayForKey(key: String) -> Bool {
return key == "angle" ? true : super.needsDisplayForKey(key)
}
override init(layer: Any) {
override init(layer: AnyObject) {
super.init(layer: layer)
let progressLayer = layer as! KDCircularProgressViewLayer
radius = progressLayer.radius
@@ -415,7 +420,7 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
super.init(coder: aDecoder)
}
override func draw(in ctx: CGContext) {
override func drawInContext(ctx: CGContext) {
UIGraphicsPushContext(ctx)
let size = bounds.size
@@ -425,63 +430,64 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
let trackLineWidth = radius * trackThickness
let progressLineWidth = radius * progressThickness
let arcRadius = max(radius - trackLineWidth/2, radius - progressLineWidth/2)
ctx.addArc(center: CGPoint(x: width/2.0, y: height/2.0), radius: arcRadius, startAngle: 0, endAngle: CGFloat.pi * 2, clockwise: false)
CGContextAddArc(ctx, width/2.0, height/2.0, arcRadius, 0, CGFloat(M_PI * 2), 0)
trackColor.set()
ctx.setStrokeColor(trackColor.cgColor)
ctx.setFillColor(progressInsideFillColor.cgColor)
ctx.setLineWidth(trackLineWidth)
ctx.setLineCap(CGLineCap.butt)
ctx.drawPath(using: .fillStroke)
CGContextSetStrokeColorWithColor(ctx, trackColor.CGColor)
CGContextSetFillColorWithColor(ctx, progressInsideFillColor.CGColor)
CGContextSetLineWidth(ctx, trackLineWidth)
CGContextSetLineCap(ctx, CGLineCap.Butt)
CGContextDrawPath(ctx, .FillStroke)
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
let reducedAngle = Utility.mod(angle, range: 360, minMax: (0, 360))
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)
if let imageCtx = UIGraphicsGetCurrentContext(){
let fromAngle = Conversion.degreesToRadians(CGFloat(-startAngle))
let toAngle = Conversion.degreesToRadians(CGFloat((clockwise == true ? -reducedAngle : reducedAngle) - startAngle))
CGContextAddArc(imageCtx, width/2.0, height/2.0, arcRadius, fromAngle, toAngle, clockwise == true ? 1 : 0)
let glowValue = GlowConstants.glowAmountForAngle(reducedAngle, glowAmount: glowAmount, glowMode: glowMode, size: width)
if glowValue > 0 {
CGContextSetShadowWithColor(imageCtx, CGSizeZero, glowValue, UIColor.blackColor().CGColor)
}
CGContextSetLineCap(imageCtx, roundedCorners == true ? .Round : .Butt)
CGContextSetLineWidth(imageCtx, progressLineWidth)
CGContextDrawPath(imageCtx, .Stroke)
guard let currentGraphicsContext = UIGraphicsGetCurrentContext() else{
return
}
if let drawMask: CGImageRef = CGBitmapContextCreateImage(currentGraphicsContext){
UIGraphicsEndImageContext()
CGContextSaveGState(ctx)
CGContextClipToMask(ctx, bounds, drawMask)
}else{
UIGraphicsEndImageContext()
}
}
let linecap: CGLineCap = roundedCorners == true ? .round : .butt
imageCtx?.setLineCap(linecap)
imageCtx?.setLineWidth(progressLineWidth)
imageCtx?.drawPath(using: .stroke)
let drawMask: CGImage = UIGraphicsGetCurrentContext()!.makeImage()!
UIGraphicsEndImageContext()
ctx.saveGState()
ctx.clip(to: bounds, mask: drawMask)
//Gradient - Fill
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)
}
if CGColorGetNumberOfComponents(color.CGColor) == 2 {
let whiteValue = CGColorGetComponents(color.CGColor)[0]
return UIColor(red: whiteValue, green: whiteValue, blue: whiteValue, alpha: 1.0)
} else {
return color
}
}
let componentsArray = rgbColorsArray.flatMap { color -> [CGFloat] in
guard let components = color.cgColor.components else { return [] }
let components: UnsafePointer<CGFloat> = CGColorGetComponents(color.CGColor)
return [components[0], components[1], components[2], 1.0]
}
drawGradientWith(context: ctx, componentsArray: componentsArray)
drawGradientWithContext(ctx, componentsArray: componentsArray)
} else {
var color: UIColor?
if colorsArray.isEmpty {
color = UIColor.white
color = UIColor.whiteColor()
} else if colorsArray.count == 1 {
color = colorsArray[0]
} else {
@@ -492,35 +498,35 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
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]))
let colorT = Utility.inverseLerp(t, minMax: ((fi - 1) * step, fi * step))
color = Utility.colorLerp(colorT, minMax: (colorsArray[i - 1], colorsArray[i]))
break
}
}
}
if let color = color {
fillRectWith(context: ctx, color: color)
fillRectWithContext(ctx, color: color)
}
}
ctx.restoreGState()
CGContextRestoreGState(ctx)
UIGraphicsPopContext()
}
private func fillRectWith(context: CGContext!, color: UIColor) {
context.setFillColor(color.cgColor)
context.fill(bounds)
private func fillRectWithContext(ctx: CGContext!, color: UIColor) {
CGContextSetFillColorWithColor(ctx, color.CGColor)
CGContextFillRect(ctx, bounds)
}
private func drawGradientWith(context: CGContext!, componentsArray: [CGFloat]) {
private func drawGradientWithContext(ctx: CGContext!, componentsArray: [CGFloat]) {
let baseSpace = CGColorSpaceCreateDeviceRGB()
let locations = locationsCache ?? gradientLocationsFor(colorCount: componentsArray.count/4, gradientWidth: bounds.size.width)
let locations = locationsCache ?? gradientLocationsForColorCount(componentsArray.count/4, gradientWidth: bounds.size.width)
let gradient: CGGradient
if let cachedGradient = gradientCache {
gradient = cachedGradient
} else {
guard let cachedGradient = CGGradient(colorSpace: baseSpace, colorComponents: componentsArray, locations: locations, count: componentsArray.count/4) else {
guard let cachedGradient = CGGradientCreateWithColorComponents(baseSpace, componentsArray, locations,componentsArray.count / 4) else {
return
}
@@ -529,18 +535,18 @@ public class KDCircularProgress: UIView, CAAnimationDelegate {
}
let halfX = bounds.size.width / 2.0
let floatPi = CGFloat.pi
let floatPi = CGFloat(M_PI)
let rotateSpeed = clockwise == true ? gradientRotateSpeed : gradientRotateSpeed * -1
let angleInRadians = Conversion.degreesToRadians(value: rotateSpeed * CGFloat(angle) - 90)
let angleInRadians = Conversion.degreesToRadians(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)
context.drawLinearGradient(gradient, start: startPoint, end: endPoint, options: .drawsBeforeStartLocation)
CGContextDrawLinearGradient(ctx, gradient, startPoint, endPoint, .DrawsBeforeStartLocation)
}
private func gradientLocationsFor(colorCount: Int, gradientWidth: CGFloat) -> [CGFloat] {
private func gradientLocationsForColorCount(colorCount: Int, gradientWidth: CGFloat) -> [CGFloat] {
if colorCount == 0 || gradientWidth == 0 {
return []
} else {
@@ -0,0 +1,442 @@
// !$*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;
LastSwiftMigration = 0800;
};
BC9E759A1A8CE4A500B1DF3D = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0800;
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)";
SWIFT_VERSION = 2.3;
};
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)";
SWIFT_VERSION = 2.3;
};
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)";
SWIFT_VERSION = 2.3;
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)";
SWIFT_VERSION = 2.3;
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 */;
}
@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:KDCircularProgress.xcodeproj">
location = "self:KDCircularProgressExample.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,112 @@
<?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,9 +1,9 @@
//
// AppDelegate.swift
// iOS Example
// KDCircularProgressExample
//
// Created by Kaan Dedeoglu on 9/21/16.
// Copyright © 2016 Kaan Dedeoglu. All rights reserved.
// Created by Kaan Dedeoglu on 2/12/15.
// Copyright (c) 2015 Kaan Dedeoglu. All rights reserved.
//
import UIKit
@@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> 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 invalidate graphics rendering callbacks. Games should use this method to pause the game.
// 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.
}
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 active 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 inactive 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,41 @@
<?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,63 +1,68 @@
<?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">
<?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">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<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="Fjt-bB-ckB">
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="9wL-Dp-scG" customClass="ViewController" customModule="iOS_Example" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="KDCircularProgressExample" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="g4C-sr-w9g"/>
<viewControllerLayoutGuide type="bottom" id="yjB-on-Hkq"/>
<viewControllerLayoutGuide type="top" id="ghF-CJ-0yv"/>
<viewControllerLayoutGuide type="bottom" id="o67-py-2aK"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="nbo-Tj-Bre">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<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="GNJ-D7-iKp">
<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/>
<constraints>
<constraint firstAttribute="width" constant="194" id="Ngq-EV-BQc"/>
<constraint firstAttribute="height" constant="30" id="i7l-jw-4bx"/>
<constraint firstAttribute="height" constant="30" id="6DH-hv-h4S"/>
<constraint firstAttribute="width" constant="194" id="oTI-kD-sOa"/>
</constraints>
<connections>
<action selector="sliderDidChangeValue:" destination="9wL-Dp-scG" eventType="valueChanged" id="NsE-GI-Orr"/>
<action selector="sliderDidChangeValue:" destination="vXZ-lx-hvc" eventType="valueChanged" id="Wfm-n6-qzL"/>
</connections>
</slider>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9ev-GJ-qTG">
<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/>
<constraints>
<constraint firstAttribute="width" constant="96" id="Zrl-Sg-9Zb"/>
<constraint firstAttribute="height" constant="30" id="xHF-qf-Hbd"/>
<constraint firstAttribute="width" constant="96" id="T9z-qf-POZ"/>
<constraint firstAttribute="height" constant="30" id="h5a-bV-EMl"/>
</constraints>
<state key="normal" title="Animate">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="animateButtonTapped:" destination="9wL-Dp-scG" eventType="touchUpInside" id="Av2-DJ-CaL"/>
<action selector="animateButtonTapped:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="b0F-cY-phl"/>
</connections>
</button>
<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"/>
<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"/>
<constraints>
<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"/>
<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"/>
</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="custom" customColorSpace="sRGB"/>
<color key="value" red="0.97441762909999996" green="1" blue="0.31255436479999998" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="IBColor2">
<color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="IBColor3">
<color key="value" red="0.085719833810000007" green="0.98039215690000003" blue="0.396044703" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="value" red="0.085719833812801863" green="0.98039215690000003" blue="0.39604470297983985" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="startAngle">
<integer key="value" value="-90"/>
@@ -79,20 +84,21 @@
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.47366009079999999" green="0.47366009079999999" blue="0.47366009079999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<animations/>
<color key="backgroundColor" red="0.4736600907821229" green="0.4736600907821229" blue="0.4736600907821229" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<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"/>
<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"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="CFY-zW-EEf" sceneMemberID="firstResponder"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-370" y="104"/>
<point key="canvasLocation" x="410" y="396"/>
</scene>
</scenes>
</document>
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>com.kaandedeoglu.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -16,6 +16,8 @@
<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,13 +1,12 @@
//
// ViewController.swift
// iOS Example
// KDCircularProgressExample
//
// Created by Kaan Dedeoglu on 9/21/16.
// Copyright © 2016 Kaan Dedeoglu. All rights reserved.
// Created by Kaan Dedeoglu on 2/12/15.
// Copyright (c) 2015 Kaan Dedeoglu. All rights reserved.
//
import UIKit
import KDCircularProgress
class ViewController: UIViewController {
var progress: KDCircularProgress!
@@ -23,19 +22,19 @@ class ViewController: UIViewController {
progress.clockwise = true
progress.gradientRotateSpeed = 2
progress.roundedCorners = false
progress.glowMode = .forward
progress.glowMode = .Forward
progress.glowAmount = 0.9
progress.set(colors: UIColor.cyan ,UIColor.white, UIColor.magenta, UIColor.white, UIColor.orange)
progress.setColors(UIColor.cyanColor() ,UIColor.whiteColor(), UIColor.magentaColor(), UIColor.whiteColor(), UIColor.orangeColor())
progress.center = CGPoint(x: view.center.x, y: view.center.y + 25)
view.addSubview(progress)
}
@IBAction func sliderDidChangeValue(_ sender: UISlider) {
@IBAction func sliderDidChangeValue(sender: UISlider) {
progress.angle = Double(sender.value)
}
@IBAction func animateButtonTapped(_ sender: UIButton) {
progress.animate(fromAngle: 0, toAngle: 360, duration: 5) { completed in
@IBAction func animateButtonTapped(sender: UIButton) {
progress.animateFromAngle(0, toAngle: 360, duration: 5) { completed in
if completed {
print("animation stopped, completed")
} else {
@@ -45,4 +44,3 @@ class ViewController: UIViewController {
}
}
@@ -7,18 +7,18 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>com.kaandedeoglu.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.2</string>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
<string>1</string>
</dict>
</plist>
@@ -0,0 +1,36 @@
//
// 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.
}
}
}
+24 -66
View File
@@ -4,42 +4,37 @@
[![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` 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/Assets/screenshot.gif)
![Screenshot](https://raw.githubusercontent.com/kaandedeoglu/KDCircularProgress/master/screenshot.gif)
![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)
![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)
```swift
progress = KDCircularProgress(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
let progress = KDCircularProgress(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
progress.startAngle = -90
progress.progressThickness = 0.2
progress.trackThickness = 0.6
progress.trackThickness = 0.7
progress.clockwise = true
progress.center = view.center
progress.gradientRotateSpeed = 2
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)
progress.roundedCorners = true
progress.glowMode = .Forward
progress.angle = 300
progress.setColors(UIColor.cyanColor() ,UIColor.whiteColor(), UIColor.magentaColor())
view.addSubview(progress)
```
@@ -70,95 +65,64 @@ Just drag `KDCircularProgress.swift` into your project.
####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`
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`
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 if true, Counter-clockwise if false. Default is true.
------
####roundedCorners: `Bool`
When true, the ends of the progress track will be drawn with a half circle radius. Default is false.
------
####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`
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.
- **.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`
The thickness of the progress. Between 0 and 1. Default is 0.4
------
####trackThickness: `CGFloat`
The thickness of the background track. Between 0 and 1. Default is 0.5
------
####trackColor: `UIColor`
The color of the background track. Default is `UIColor.blackColor()`.
------
####progressInsideFillColor: `UIColor`
The color of the center of the circle. Default is `UIColor.clearColor()`.
------
##Methods
```swift
override public init(frame: CGRect)
```
Initialize with a frame. Please only use square frames.
------
```swift
convenience public init(frame:CGRect, colors: UIColor...)
```
Initialize with a frame and the gradient colors.
------
```swift
public func set(colors: UIColor...)
public func set(colors: [UIColor])
public func setColors(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)?)
```
@@ -167,24 +131,18 @@ Animate the progress from an initial value to a final value, with a completion b
`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
```
@@ -199,7 +157,7 @@ Prefering light colors in the gradients gives better results. As mentioned befor
- [ ] Carthage Support
- [x] CocoaPods Support
- [x] IBDesignable/IBInspectable support
- [x] Adding a `progress` property as an alternative to `angle`
- [ ] Adding a `progress` property as an alternative to `angle`
- [ ] Clean up
##Contact
@@ -211,7 +169,7 @@ Drop me an email if you want discuss anything further.
The MIT License (MIT)
Copyright (c) 2016 Kaan Dedeoglu
Copyright (c) 2015 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

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