├── CircularProgressView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── CircularProgressView.xccheckout │ └── xcuserdata │ │ └── wlt.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── wlt.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── CircularProgressView.xcscheme │ └── xcschememanagement.plist ├── CircularProgressView ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── CircularProgressView.swift ├── CustomCell.swift ├── DataLoader.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── 120-1.png │ │ ├── 120.png │ │ ├── 152.png │ │ ├── 180.png │ │ ├── 29.png │ │ ├── 40.png │ │ ├── 58-1.png │ │ ├── 58.png │ │ ├── 76.png │ │ ├── 80-1.png │ │ ├── 80.png │ │ ├── 87.png │ │ └── Contents.json │ ├── arya.imageset │ │ ├── Contents.json │ │ ├── arya.png │ │ ├── arya@2x.png │ │ └── arya@3x.png │ ├── brienne.imageset │ │ ├── Contents.json │ │ ├── brienne.png │ │ ├── brienne@2x.png │ │ └── brienne@3x.png │ ├── cersei.imageset │ │ ├── Contents.json │ │ ├── cersei.png │ │ ├── cersei@2x.png │ │ └── cersei@3x.png │ ├── clockwise.imageset │ │ ├── Contents.json │ │ ├── clockwise.png │ │ ├── clockwise@2x.png │ │ └── clockwise@3x.png │ ├── counterclockwise.imageset │ │ ├── Contents.json │ │ ├── counterclockwise.png │ │ ├── counterclockwise@2x.png │ │ └── counterclockwise@3x.png │ ├── danny.imageset │ │ ├── Contents.json │ │ ├── danny.png │ │ ├── danny@2x.png │ │ └── danny@3x.png │ ├── hide_percents.imageset │ │ ├── Contents.json │ │ ├── hide_percents.png │ │ ├── hide_percents@2x.png │ │ └── hide_percents@3x.png │ ├── jaime.imageset │ │ ├── Contents.json │ │ ├── jaime.png │ │ ├── jaime@2x.png │ │ └── jaime@3x.png │ ├── littlefinger.imageset │ │ ├── Contents.json │ │ ├── littlefinger.png │ │ ├── littlefinger@2x.png │ │ └── littlefinger@3x.png │ ├── margie.imageset │ │ ├── Contents.json │ │ ├── margie.png │ │ ├── margie@2x.png │ │ └── margie@3x.png │ ├── ned.imageset │ │ ├── Contents.json │ │ ├── ned.png │ │ ├── ned@2x.png │ │ └── ned@3x.png │ ├── progress_left.imageset │ │ ├── Contents.json │ │ ├── progress_left.png │ │ ├── progress_left@2x.png │ │ └── progress_left@3x.png │ ├── progress_made.imageset │ │ ├── Contents.json │ │ ├── progress_made.png │ │ ├── progress_made@2x.png │ │ └── progress_made@3x.png │ ├── show_percents.imageset │ │ ├── Contents.json │ │ ├── show_percents.png │ │ ├── show_percents@2x.png │ │ └── show_percents@3x.png │ ├── snow.imageset │ │ ├── Contents.json │ │ ├── snow.png │ │ ├── snow@2x.png │ │ └── snow@3x.png │ └── theon.imageset │ │ ├── Contents.json │ │ ├── theon.png │ │ ├── theon@2x.png │ │ └── theon@3x.png ├── Info.plist └── ViewController.swift ├── IB_rendering.png ├── LICENSE ├── README.md ├── demo_app.png └── watch.png /CircularProgressView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3B2242C61AED71A200F39C3F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B2242C51AED71A200F39C3F /* AppDelegate.swift */; }; 11 | 3B2242C81AED71A200F39C3F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B2242C71AED71A200F39C3F /* ViewController.swift */; }; 12 | 3B2242CB1AED71A200F39C3F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3B2242C91AED71A200F39C3F /* Main.storyboard */; }; 13 | 3B2242CD1AED71A200F39C3F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3B2242CC1AED71A200F39C3F /* Images.xcassets */; }; 14 | 3B2242D01AED71A200F39C3F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3B2242CE1AED71A200F39C3F /* LaunchScreen.xib */; }; 15 | 3B2242E61AED71D400F39C3F /* CircularProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B2242E51AED71D400F39C3F /* CircularProgressView.swift */; }; 16 | 3BB987321AF4F84E00FAEB17 /* CustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BB987301AF4F84E00FAEB17 /* CustomCell.swift */; }; 17 | 3BB987331AF4F84E00FAEB17 /* DataLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BB987311AF4F84E00FAEB17 /* DataLoader.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 3B2242C01AED71A200F39C3F /* CircularProgressView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CircularProgressView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 3B2242C41AED71A200F39C3F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | 3B2242C51AED71A200F39C3F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | 3B2242C71AED71A200F39C3F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 25 | 3B2242CA1AED71A200F39C3F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 26 | 3B2242CC1AED71A200F39C3F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 27 | 3B2242CF1AED71A200F39C3F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 28 | 3B2242E51AED71D400F39C3F /* CircularProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircularProgressView.swift; sourceTree = ""; }; 29 | 3BB987301AF4F84E00FAEB17 /* CustomCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomCell.swift; sourceTree = ""; }; 30 | 3BB987311AF4F84E00FAEB17 /* DataLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataLoader.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 3B2242BD1AED71A200F39C3F /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 3B2242B71AED71A200F39C3F = { 45 | isa = PBXGroup; 46 | children = ( 47 | 3B2242C21AED71A200F39C3F /* CircularProgressView */, 48 | 3B2242C11AED71A200F39C3F /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 3B2242C11AED71A200F39C3F /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 3B2242C01AED71A200F39C3F /* CircularProgressView.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 3B2242C21AED71A200F39C3F /* CircularProgressView */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 3B2242C51AED71A200F39C3F /* AppDelegate.swift */, 64 | 3B2242C71AED71A200F39C3F /* ViewController.swift */, 65 | 3BB987301AF4F84E00FAEB17 /* CustomCell.swift */, 66 | 3BB987311AF4F84E00FAEB17 /* DataLoader.swift */, 67 | 3B2242E51AED71D400F39C3F /* CircularProgressView.swift */, 68 | 3B2242C91AED71A200F39C3F /* Main.storyboard */, 69 | 3B2242CE1AED71A200F39C3F /* LaunchScreen.xib */, 70 | 3B2242CC1AED71A200F39C3F /* Images.xcassets */, 71 | 3B2242C31AED71A200F39C3F /* Supporting Files */, 72 | ); 73 | path = CircularProgressView; 74 | sourceTree = ""; 75 | }; 76 | 3B2242C31AED71A200F39C3F /* Supporting Files */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 3B2242C41AED71A200F39C3F /* Info.plist */, 80 | ); 81 | name = "Supporting Files"; 82 | sourceTree = ""; 83 | }; 84 | /* End PBXGroup section */ 85 | 86 | /* Begin PBXNativeTarget section */ 87 | 3B2242BF1AED71A200F39C3F /* CircularProgressView */ = { 88 | isa = PBXNativeTarget; 89 | buildConfigurationList = 3B2242DF1AED71A200F39C3F /* Build configuration list for PBXNativeTarget "CircularProgressView" */; 90 | buildPhases = ( 91 | 3B2242BC1AED71A200F39C3F /* Sources */, 92 | 3B2242BD1AED71A200F39C3F /* Frameworks */, 93 | 3B2242BE1AED71A200F39C3F /* Resources */, 94 | ); 95 | buildRules = ( 96 | ); 97 | dependencies = ( 98 | ); 99 | name = CircularProgressView; 100 | productName = CircularProgressView; 101 | productReference = 3B2242C01AED71A200F39C3F /* CircularProgressView.app */; 102 | productType = "com.apple.product-type.application"; 103 | }; 104 | /* End PBXNativeTarget section */ 105 | 106 | /* Begin PBXProject section */ 107 | 3B2242B81AED71A200F39C3F /* Project object */ = { 108 | isa = PBXProject; 109 | attributes = { 110 | LastUpgradeCheck = 0630; 111 | ORGANIZATIONNAME = "Wagner Truppel"; 112 | TargetAttributes = { 113 | 3B2242BF1AED71A200F39C3F = { 114 | CreatedOnToolsVersion = 6.3; 115 | DevelopmentTeam = 9MP5BB6ZRE; 116 | }; 117 | }; 118 | }; 119 | buildConfigurationList = 3B2242BB1AED71A200F39C3F /* Build configuration list for PBXProject "CircularProgressView" */; 120 | compatibilityVersion = "Xcode 3.2"; 121 | developmentRegion = English; 122 | hasScannedForEncodings = 0; 123 | knownRegions = ( 124 | en, 125 | Base, 126 | ); 127 | mainGroup = 3B2242B71AED71A200F39C3F; 128 | productRefGroup = 3B2242C11AED71A200F39C3F /* Products */; 129 | projectDirPath = ""; 130 | projectRoot = ""; 131 | targets = ( 132 | 3B2242BF1AED71A200F39C3F /* CircularProgressView */, 133 | ); 134 | }; 135 | /* End PBXProject section */ 136 | 137 | /* Begin PBXResourcesBuildPhase section */ 138 | 3B2242BE1AED71A200F39C3F /* Resources */ = { 139 | isa = PBXResourcesBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | 3B2242CB1AED71A200F39C3F /* Main.storyboard in Resources */, 143 | 3B2242D01AED71A200F39C3F /* LaunchScreen.xib in Resources */, 144 | 3B2242CD1AED71A200F39C3F /* Images.xcassets in Resources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXResourcesBuildPhase section */ 149 | 150 | /* Begin PBXSourcesBuildPhase section */ 151 | 3B2242BC1AED71A200F39C3F /* Sources */ = { 152 | isa = PBXSourcesBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | 3BB987331AF4F84E00FAEB17 /* DataLoader.swift in Sources */, 156 | 3B2242C81AED71A200F39C3F /* ViewController.swift in Sources */, 157 | 3B2242E61AED71D400F39C3F /* CircularProgressView.swift in Sources */, 158 | 3BB987321AF4F84E00FAEB17 /* CustomCell.swift in Sources */, 159 | 3B2242C61AED71A200F39C3F /* AppDelegate.swift in Sources */, 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | }; 163 | /* End PBXSourcesBuildPhase section */ 164 | 165 | /* Begin PBXVariantGroup section */ 166 | 3B2242C91AED71A200F39C3F /* Main.storyboard */ = { 167 | isa = PBXVariantGroup; 168 | children = ( 169 | 3B2242CA1AED71A200F39C3F /* Base */, 170 | ); 171 | name = Main.storyboard; 172 | sourceTree = ""; 173 | }; 174 | 3B2242CE1AED71A200F39C3F /* LaunchScreen.xib */ = { 175 | isa = PBXVariantGroup; 176 | children = ( 177 | 3B2242CF1AED71A200F39C3F /* Base */, 178 | ); 179 | name = LaunchScreen.xib; 180 | sourceTree = ""; 181 | }; 182 | /* End PBXVariantGroup section */ 183 | 184 | /* Begin XCBuildConfiguration section */ 185 | 3B2242DD1AED71A200F39C3F /* Debug */ = { 186 | isa = XCBuildConfiguration; 187 | buildSettings = { 188 | ALWAYS_SEARCH_USER_PATHS = NO; 189 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 190 | CLANG_CXX_LIBRARY = "libc++"; 191 | CLANG_ENABLE_MODULES = YES; 192 | CLANG_ENABLE_OBJC_ARC = YES; 193 | CLANG_WARN_BOOL_CONVERSION = YES; 194 | CLANG_WARN_CONSTANT_CONVERSION = YES; 195 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 196 | CLANG_WARN_EMPTY_BODY = YES; 197 | CLANG_WARN_ENUM_CONVERSION = YES; 198 | CLANG_WARN_INT_CONVERSION = YES; 199 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 200 | CLANG_WARN_UNREACHABLE_CODE = YES; 201 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 202 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 203 | COPY_PHASE_STRIP = NO; 204 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 205 | ENABLE_STRICT_OBJC_MSGSEND = YES; 206 | GCC_C_LANGUAGE_STANDARD = gnu99; 207 | GCC_DYNAMIC_NO_PIC = NO; 208 | GCC_NO_COMMON_BLOCKS = YES; 209 | GCC_OPTIMIZATION_LEVEL = 0; 210 | GCC_PREPROCESSOR_DEFINITIONS = ( 211 | "DEBUG=1", 212 | "$(inherited)", 213 | ); 214 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 215 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 216 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 217 | GCC_WARN_UNDECLARED_SELECTOR = YES; 218 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 219 | GCC_WARN_UNUSED_FUNCTION = YES; 220 | GCC_WARN_UNUSED_VARIABLE = YES; 221 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 222 | MTL_ENABLE_DEBUG_INFO = YES; 223 | ONLY_ACTIVE_ARCH = YES; 224 | SDKROOT = iphoneos; 225 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 226 | TARGETED_DEVICE_FAMILY = "1,2"; 227 | }; 228 | name = Debug; 229 | }; 230 | 3B2242DE1AED71A200F39C3F /* Release */ = { 231 | isa = XCBuildConfiguration; 232 | buildSettings = { 233 | ALWAYS_SEARCH_USER_PATHS = NO; 234 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 235 | CLANG_CXX_LIBRARY = "libc++"; 236 | CLANG_ENABLE_MODULES = YES; 237 | CLANG_ENABLE_OBJC_ARC = YES; 238 | CLANG_WARN_BOOL_CONVERSION = YES; 239 | CLANG_WARN_CONSTANT_CONVERSION = YES; 240 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 241 | CLANG_WARN_EMPTY_BODY = YES; 242 | CLANG_WARN_ENUM_CONVERSION = YES; 243 | CLANG_WARN_INT_CONVERSION = YES; 244 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 245 | CLANG_WARN_UNREACHABLE_CODE = YES; 246 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 247 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 248 | COPY_PHASE_STRIP = NO; 249 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 250 | ENABLE_NS_ASSERTIONS = NO; 251 | ENABLE_STRICT_OBJC_MSGSEND = YES; 252 | GCC_C_LANGUAGE_STANDARD = gnu99; 253 | GCC_NO_COMMON_BLOCKS = YES; 254 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 255 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 256 | GCC_WARN_UNDECLARED_SELECTOR = YES; 257 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 258 | GCC_WARN_UNUSED_FUNCTION = YES; 259 | GCC_WARN_UNUSED_VARIABLE = YES; 260 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 261 | MTL_ENABLE_DEBUG_INFO = NO; 262 | SDKROOT = iphoneos; 263 | TARGETED_DEVICE_FAMILY = "1,2"; 264 | VALIDATE_PRODUCT = YES; 265 | }; 266 | name = Release; 267 | }; 268 | 3B2242E01AED71A200F39C3F /* Debug */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 272 | CODE_SIGN_IDENTITY = "iPhone Developer"; 273 | INFOPLIST_FILE = CircularProgressView/Info.plist; 274 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 275 | PRODUCT_NAME = "$(TARGET_NAME)"; 276 | }; 277 | name = Debug; 278 | }; 279 | 3B2242E11AED71A200F39C3F /* Release */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 283 | CODE_SIGN_IDENTITY = "iPhone Developer"; 284 | INFOPLIST_FILE = CircularProgressView/Info.plist; 285 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 286 | PRODUCT_NAME = "$(TARGET_NAME)"; 287 | }; 288 | name = Release; 289 | }; 290 | /* End XCBuildConfiguration section */ 291 | 292 | /* Begin XCConfigurationList section */ 293 | 3B2242BB1AED71A200F39C3F /* Build configuration list for PBXProject "CircularProgressView" */ = { 294 | isa = XCConfigurationList; 295 | buildConfigurations = ( 296 | 3B2242DD1AED71A200F39C3F /* Debug */, 297 | 3B2242DE1AED71A200F39C3F /* Release */, 298 | ); 299 | defaultConfigurationIsVisible = 0; 300 | defaultConfigurationName = Release; 301 | }; 302 | 3B2242DF1AED71A200F39C3F /* Build configuration list for PBXNativeTarget "CircularProgressView" */ = { 303 | isa = XCConfigurationList; 304 | buildConfigurations = ( 305 | 3B2242E01AED71A200F39C3F /* Debug */, 306 | 3B2242E11AED71A200F39C3F /* Release */, 307 | ); 308 | defaultConfigurationIsVisible = 0; 309 | defaultConfigurationName = Release; 310 | }; 311 | /* End XCConfigurationList section */ 312 | }; 313 | rootObject = 3B2242B81AED71A200F39C3F /* Project object */; 314 | } 315 | -------------------------------------------------------------------------------- /CircularProgressView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CircularProgressView.xcodeproj/project.xcworkspace/xcshareddata/CircularProgressView.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 61E599C8-133F-458D-8C12-8DEEE547D774 9 | IDESourceControlProjectName 10 | CircularProgressView 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | F754004B7D5F9F723E6CDC45A6CE271CF3E48213 14 | https://github.com/wltrup/iOS-Swift-Circular-Progress-View.git 15 | 16 | IDESourceControlProjectPath 17 | CircularProgressView.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | F754004B7D5F9F723E6CDC45A6CE271CF3E48213 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/wltrup/iOS-Swift-Circular-Progress-View.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | F754004B7D5F9F723E6CDC45A6CE271CF3E48213 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | F754004B7D5F9F723E6CDC45A6CE271CF3E48213 36 | IDESourceControlWCCName 37 | iOS-Swift-Circular-Progress-View 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CircularProgressView.xcodeproj/project.xcworkspace/xcuserdata/wlt.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView.xcodeproj/project.xcworkspace/xcuserdata/wlt.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CircularProgressView.xcodeproj/xcuserdata/wlt.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /CircularProgressView.xcodeproj/xcuserdata/wlt.xcuserdatad/xcschemes/CircularProgressView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /CircularProgressView.xcodeproj/xcuserdata/wlt.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CircularProgressView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 3B2242BF1AED71A200F39C3F 16 | 17 | primary 18 | 19 | 20 | 3B2242D41AED71A200F39C3F 21 | 22 | primary 23 | 24 | 25 | 3B85E68C1AF2E9420004E7E5 26 | 27 | primary 28 | 29 | 30 | 3B85E6A01AF2E9430004E7E5 31 | 32 | primary 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /CircularProgressView/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CircularProgressView 4 | // 5 | // Created by Wagner Truppel on 26/04/2015. 6 | // Copyright (c) 2015 Wagner Truppel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate 13 | { 14 | var window: UIWindow? 15 | 16 | func application(application: UIApplication, 17 | didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 18 | { 19 | // Override point for customization after application launch. 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(application: UIApplication) 24 | { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain 26 | // types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits 27 | // the application and it begins the transition to the background state. 28 | 29 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. 30 | // Games should use this method to pause the game. 31 | } 32 | 33 | func applicationDidEnterBackground(application: UIApplication) 34 | { 35 | // Use this method to release shared resources, save user data, invalidate timers, and store enough 36 | // application state information to restore your application to its current state in case it is 37 | // terminated later. 38 | 39 | // If your application supports background execution, this method is called instead of 40 | // applicationWillTerminate: when the user quits. 41 | } 42 | 43 | func applicationWillEnterForeground(application: UIApplication) 44 | { 45 | // Called as part of the transition from the background to the inactive state; here you can undo many 46 | // of the changes made on entering the background. 47 | } 48 | 49 | func applicationDidBecomeActive(application: UIApplication) 50 | { 51 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the 52 | // application was previously in the background, optionally refresh the user interface. 53 | } 54 | 55 | func applicationWillTerminate(application: UIApplication) 56 | { 57 | // Called when the application is about to terminate. Save data if appropriate. 58 | // See also applicationDidEnterBackground:. 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /CircularProgressView/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /CircularProgressView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 77 | 86 | 96 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 158 | 170 | 182 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | -------------------------------------------------------------------------------- /CircularProgressView/CircularProgressView.swift: -------------------------------------------------------------------------------- 1 | /* 2 | CircularProgressView.swift 3 | CircularProgressView 4 | 5 | Created by Wagner Truppel on 26/04/2015. 6 | 7 | The MIT License (MIT) 8 | 9 | Copyright (c) 2015 Wagner Truppel (wagner@restlessbrain.com). 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 27 | SOFTWARE. 28 | 29 | When crediting me (Wagner Truppel) for this work, please use one 30 | of the following two suggested formats: 31 | 32 | Uses "CircularProgressView" code by Wagner Truppel 33 | http://www.restlessbrain.com/wagner/ 34 | 35 | or 36 | 37 | CircularProgressView code by Wagner Truppel 38 | http://www.restlessbrain.com/wagner/ 39 | 40 | Where possible, a hyperlink to http://www.restlessbrain.com/wagner/ 41 | would be appreciated. 42 | */ 43 | 44 | import UIKit 45 | 46 | @IBDesignable 47 | class CircularProgressView: UIView 48 | { 49 | // The color of the full track. 50 | @IBInspectable var trackTint: UIColor { 51 | 52 | get { return iTrackTint } 53 | 54 | set 55 | { 56 | if newValue != iTrackTint 57 | { 58 | iTrackTint = newValue 59 | setNeedsDisplay() 60 | 61 | if newValue == iProgressTint 62 | { 63 | print("[CircularProgressView] WARNING: setting trackTint to the same color as progressTint " + 64 | "will make the circular progress view appear as if it's not progressing.") 65 | } 66 | } 67 | } 68 | } 69 | private var iTrackTint: UIColor = UIColor.blackColor() 70 | 71 | 72 | // The color of the part of the track representing progress. 73 | @IBInspectable var progressTint: UIColor { 74 | 75 | get { return iProgressTint } 76 | 77 | set 78 | { 79 | if newValue != iProgressTint 80 | { 81 | iProgressTint = newValue 82 | setNeedsDisplay() 83 | 84 | if newValue == iTrackTint 85 | { 86 | print("[CircularProgressView] WARNING: setting progressTint to the same color as trackTint " + 87 | "will make the circular progress view appear as if it's not progressing.") 88 | } 89 | } 90 | } 91 | } 92 | private var iProgressTint: UIColor = UIColor.whiteColor() 93 | 94 | 95 | // The thickness of the full track, in points. It shouldn't be less than minTrackThickness, 96 | // and is clipped to that value if set otherwise. Always set this value before setting the 97 | // values of either progressThickness or progressThicknessFraction. 98 | @IBInspectable var trackThickness: CGFloat { 99 | 100 | get { return iTrackThickness } 101 | 102 | set 103 | { 104 | if newValue != iTrackThickness 105 | { 106 | iTrackThickness = max(minTrackThickness, newValue) 107 | updateProgressThickness(iProgressThickness) 108 | setNeedsDisplay() 109 | } 110 | } 111 | } 112 | private var iTrackThickness: CGFloat = 30.0 // points 113 | private let minTrackThickness: CGFloat = 6.0 // points 114 | 115 | 116 | // The thickness of the part of the track representing progress, in points. Alternatively, 117 | // use progressThicknessFraction (see below) to set the progress thickness. progressThickness 118 | // should be in the range [minProgressThickness, trackThickness]. Note that the range depends 119 | // on the current value of trackThickness so always set that value first before setting the value 120 | // of progressThickness. 121 | @IBInspectable var progressThickness: CGFloat { 122 | 123 | get { return iProgressThickness } 124 | 125 | set 126 | { 127 | if newValue != iProgressThickness 128 | { 129 | updateProgressThickness(newValue) 130 | setNeedsDisplay() 131 | } 132 | } 133 | } 134 | private var iProgressThickness: CGFloat = 10.0 // points 135 | private let minProgressThickness: CGFloat = 2.0 // points 136 | 137 | 138 | // The thickness of the part of the track representing progress, as a fraction of the full track 139 | // thickness. Alternatively, use progressThickness (see above) to set the progress thickness. 140 | // progressThicknessFraction should be a floating point number in the range 141 | // [minProgressThickness/trackThickness, 1]. Values outside that range are clipped to that range. 142 | // Note that the range depends on the current value of trackThickness so always set that value 143 | // first before setting the value of progressThicknessFraction. 144 | /*@IBInspectable*/ var progressThicknessFraction: CGFloat { 145 | 146 | get { return iProgressThicknessFraction } 147 | 148 | set 149 | { 150 | if newValue != iProgressThicknessFraction 151 | { 152 | iProgressThicknessFraction = max(minProgressThickness / iTrackThickness, newValue) 153 | iProgressThicknessFraction = min(iProgressThicknessFraction, 1) 154 | self.progressThickness = iProgressThicknessFraction * iTrackThickness 155 | setNeedsDisplay() 156 | } 157 | } 158 | } 159 | private var iProgressThicknessFraction: CGFloat = 0.5 160 | 161 | 162 | // Whether the progress track grows clockwise or counterclockwise as the progress value increases. 163 | @IBInspectable var clockwise: Bool { 164 | 165 | get { return iClockwise } 166 | 167 | set 168 | { 169 | if newValue != iClockwise 170 | { 171 | iClockwise = newValue 172 | setNeedsDisplay() 173 | } 174 | } 175 | } 176 | private var iClockwise = true 177 | 178 | 179 | // Whether the progress track shows the progress made (normal mode) or the progress remaining (reversed mode). 180 | // The default value is false, ie, show the progress made. 181 | @IBInspectable var reversed: Bool { 182 | 183 | get { return iReversed } 184 | 185 | set 186 | { 187 | if newValue != iReversed 188 | { 189 | iReversed = newValue 190 | updateLabel() 191 | setNeedsDisplay() 192 | } 193 | } 194 | } 195 | private var iReversed = false 196 | 197 | 198 | // Whether to display the percent label. Setting this property is equivalent to accessing the 199 | // percent label directly and hiding or unhiding it so it's just a convenience. 200 | @IBInspectable var showPercent: Bool { 201 | 202 | get { return iShowPercent } 203 | 204 | set 205 | { 206 | // if showing then we want to have a label; do something innocuous to force the label to be created. 207 | if newValue { self.percentLabel?.alpha = 1.0 } 208 | 209 | if newValue != iShowPercent 210 | { 211 | iShowPercent = newValue 212 | iPercentLabel?.hidden = !iShowPercent 213 | if iShowPercent { updateLabel() } 214 | setNeedsDisplay() 215 | } 216 | } 217 | } 218 | private var iShowPercent = true 219 | 220 | 221 | // The color of the percent text when it's showing. Setting this property is equivalent to accessing the 222 | // percent label directly and setting its text color property so it's just a convenience. 223 | @IBInspectable var percentTint: UIColor { 224 | 225 | get { return iPercentTint } 226 | 227 | set 228 | { 229 | if newValue != iPercentTint 230 | { 231 | iPercentTint = newValue 232 | iPercentLabel?.textColor = iPercentTint 233 | setNeedsDisplay() 234 | } 235 | } 236 | } 237 | private var iPercentTint = UIColor.blackColor() 238 | 239 | 240 | // The font size of the percent text when it's showing. Setting this property is equivalent to 241 | // accessing the percent label directly and setting its text font size so it's just a convenience. 242 | @IBInspectable var percentSize: CGFloat { 243 | 244 | get { return iPercentSize } 245 | 246 | set 247 | { 248 | if newValue != iPercentSize 249 | { 250 | iPercentSize = newValue 251 | updateLabelFontSize() 252 | setNeedsDisplay() 253 | } 254 | } 255 | } 256 | private var iPercentSize: CGFloat = 48 257 | 258 | 259 | // Whether to display the percent text using the bold or regular system font. Setting this property is 260 | // equivalent to accessing the percent label directly and setting its font property so it's just a convenience. 261 | @IBInspectable var percentBold: Bool { 262 | 263 | get { return iPercentBold } 264 | 265 | set 266 | { 267 | if newValue != iPercentBold 268 | { 269 | iPercentBold = newValue 270 | updateLabelFontSize() 271 | setNeedsDisplay() 272 | } 273 | } 274 | } 275 | private var iPercentBold = true 276 | 277 | 278 | // The value representing the progress made. It should be in the range [0, 1]. Values outside 279 | // that range will be clipped to that range. 280 | @IBInspectable var value: CGFloat { 281 | 282 | get { return iValue } 283 | 284 | set 285 | { 286 | let val: CGFloat 287 | #if TARGET_INTERFACE_BUILDER 288 | val = 0.01 * newValue // interpret the integers in the inspector stepper as percentages 289 | #else 290 | val = newValue 291 | #endif 292 | 293 | if val != iValue 294 | { 295 | iValue = max(0, val) 296 | iValue = min(iValue, 1) 297 | updateLabel() 298 | setNeedsDisplay() 299 | } 300 | } 301 | } 302 | private var iValue: CGFloat = 0.75 303 | 304 | 305 | // An optional UILabel to appear at the center of the circular progress view. This property can 306 | // be set with any UILabel instance or one can be automatically provided, then accessed and 307 | // customized as desired. Note that, either way, certain layout constraints are created to 308 | // keep the label centered. Those constraints should not be messed with. 309 | @IBOutlet var percentLabel: UILabel? { 310 | 311 | get 312 | { 313 | if iPercentLabel == nil { self.percentLabel = UILabel() } 314 | return iPercentLabel 315 | } 316 | 317 | set(newLabel) 318 | { 319 | if newLabel != iPercentLabel 320 | { 321 | iPercentLabel?.removeFromSuperview() 322 | iPercentLabel = newLabel 323 | 324 | if let label = iPercentLabel 325 | { 326 | addSubview(label) 327 | 328 | updateLabelFontSize() 329 | label.textColor = iPercentTint 330 | 331 | label.textAlignment = .Center 332 | label.adjustsFontSizeToFitWidth = true 333 | label.baselineAdjustment = .AlignCenters 334 | label.minimumScaleFactor = 0.5 335 | 336 | label.translatesAutoresizingMaskIntoConstraints = false 337 | label.removeConstraints(label.constraints) 338 | 339 | var constraint: NSLayoutConstraint 340 | 341 | constraint = NSLayoutConstraint(item: label, attribute: .CenterX, 342 | relatedBy: .Equal, toItem: self, attribute: .CenterX, multiplier: 1.0, constant: 0) 343 | addConstraint(constraint) 344 | 345 | constraint = NSLayoutConstraint(item: label, attribute: .CenterY, 346 | relatedBy: .Equal, toItem: self, attribute: .CenterY, multiplier: 1.0, constant: 0) 347 | addConstraint(constraint) 348 | 349 | let w = CGRectGetWidth(bounds) 350 | let h = CGRectGetHeight(bounds) 351 | var s = (min(w, h) - iTrackThickness) / 2 352 | s *= 0.9 // Use up to 90% of the space between opposite sides of the inner circle. 353 | 354 | constraint = NSLayoutConstraint(item: label, attribute: .Width, 355 | relatedBy: .LessThanOrEqual, toItem: self, attribute: .Width, multiplier: 0.0, constant: s) 356 | addConstraint(constraint) 357 | 358 | constraint = NSLayoutConstraint(item: label, attribute: .Height, 359 | relatedBy: .LessThanOrEqual, toItem: self, attribute: .Height, multiplier: 0.0, constant: s) 360 | addConstraint(constraint) 361 | 362 | updateLabel() 363 | setNeedsDisplay() 364 | } 365 | } 366 | } 367 | } 368 | private var iPercentLabel: UILabel? 369 | 370 | 371 | override func drawRect(rect: CGRect) 372 | { 373 | let w = CGRectGetWidth(bounds) 374 | let h = CGRectGetHeight(bounds) 375 | let r = (min(w, h) - iTrackThickness) / 2 376 | let cp = CGPoint(x: w/2, y: h/2) // *not* 'let cp = center' because center will be in the frame's coord system! 377 | 378 | // Draw the full track. 379 | fillTrack(center: cp, radius: r, sangle: 0, eangle: CGFloat(2*M_PI), 380 | color: iTrackTint, thickness: iTrackThickness, clockwise: true) 381 | 382 | // Draw the progress track. 383 | var val = (iReversed ? (1 - iValue) : iValue) 384 | val = (iClockwise ? +iValue : -iValue) 385 | let clockwise = (iReversed ? !iClockwise : iClockwise) 386 | fillTrack(center: cp, radius: r, sangle: CGFloat(-M_PI/2), eangle: CGFloat(2*M_PI*Double(val) - M_PI/2), 387 | color: iProgressTint, thickness: iProgressThickness, clockwise: clockwise) 388 | } 389 | 390 | 391 | private func fillTrack(center center: CGPoint, radius: CGFloat, sangle: CGFloat, eangle: CGFloat, 392 | color: UIColor, thickness: CGFloat, clockwise: Bool) 393 | { 394 | color.set() 395 | let p = UIBezierPath() 396 | p.lineWidth = thickness 397 | p.lineCapStyle = .Round 398 | p.addArcWithCenter(center, radius: radius, startAngle: sangle, endAngle: eangle, clockwise: clockwise) 399 | p.stroke() 400 | } 401 | 402 | 403 | private func updateProgressThickness(value: CGFloat) 404 | { 405 | iProgressThickness = max(minProgressThickness, value) 406 | iProgressThickness = min(iProgressThickness, iTrackThickness) 407 | self.progressThicknessFraction = iProgressThickness / iTrackThickness 408 | } 409 | 410 | 411 | private func updateLabelFontSize() 412 | { 413 | if iPercentBold 414 | { 415 | iPercentLabel?.font = UIFont.boldSystemFontOfSize(iPercentSize) 416 | } 417 | else 418 | { 419 | iPercentLabel?.font = UIFont.systemFontOfSize(iPercentSize) 420 | } 421 | } 422 | 423 | 424 | private func updateLabel() 425 | { 426 | if let label = iPercentLabel where !label.hidden 427 | { 428 | let val = (iReversed ? (1 - iValue) : iValue) 429 | label.text = "\(Int(val * 100.0) % 101) %" 430 | label.sizeToFit() 431 | setNeedsLayout() 432 | } 433 | } 434 | 435 | 436 | #if TARGET_INTERFACE_BUILDER 437 | 438 | override func prepareForInterfaceBuilder() 439 | { 440 | super.prepareForInterfaceBuilder() 441 | percentLabel?.hidden = !showPercent 442 | } 443 | 444 | #endif 445 | } 446 | -------------------------------------------------------------------------------- /CircularProgressView/CustomCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomCell.swift 3 | // CircularProgressView 4 | // 5 | // Created by Wagner Truppel on 01/05/2015. 6 | // Copyright (c) 2015 Wagner Truppel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | class CustomCell: UITableViewCell 13 | { 14 | @IBOutlet weak var photoView: UIImageView! 15 | @IBOutlet weak var progressView: CircularProgressView! 16 | @IBOutlet weak var nameLabel: UILabel! 17 | @IBOutlet weak var emailLabel: UILabel! 18 | 19 | var dataItem: DataItem? { 20 | didSet { 21 | if let dataItem = self.dataItem 22 | { 23 | self.nameLabel.text = dataItem.personName 24 | self.emailLabel.text = dataItem.personEmail 25 | self.photoView!.image = UIImage(named: dataItem.photoName) 26 | } 27 | else 28 | { 29 | self.nameLabel.text = nil 30 | self.emailLabel.text = nil 31 | self.photoView!.image = nil 32 | } 33 | } 34 | } 35 | 36 | override func awakeFromNib() 37 | { 38 | super.awakeFromNib() 39 | showContent(false, animated: false) 40 | } 41 | 42 | func showContent(show: Bool, animated: Bool) 43 | { 44 | if animated 45 | { 46 | let duration: NSTimeInterval = (show ? 0.3 : 0.25) 47 | animateContent(duration, show: show) 48 | } 49 | else 50 | { 51 | let alpha: CGFloat = (show ? 1.0 : 0.0) 52 | 53 | photoView.alpha = alpha 54 | progressView.alpha = 1.0 - alpha 55 | 56 | nameLabel.hidden = !show 57 | nameLabel.alpha = alpha 58 | 59 | emailLabel.hidden = !show 60 | emailLabel.alpha = alpha 61 | } 62 | } 63 | } 64 | 65 | 66 | // Content animation 67 | extension CustomCell 68 | { 69 | private func animateContent(duration: NSTimeInterval, show: Bool) 70 | { 71 | if show 72 | { 73 | UIView.animateWithDuration(0.75, 74 | animations: { 75 | self.photoView.alpha = 1.0 76 | self.progressView.alpha = 0.0 77 | }, 78 | completion: { (completed) -> Void in 79 | self.animateView(self.nameLabel, 80 | duration: duration, show: true, 81 | completion: { (completed) -> Void in 82 | self.animateView(self.emailLabel, 83 | duration: duration, show: show, completion: nil) 84 | }) 85 | }) 86 | } 87 | else 88 | { 89 | self.animateView(self.emailLabel, 90 | duration: duration, show: false, 91 | completion: { (completed) -> Void in 92 | self.animateView(self.nameLabel, 93 | duration: duration, show: false, 94 | completion: { (completed) -> Void in 95 | UIView.animateWithDuration(0.75, 96 | animations: { 97 | self.photoView.alpha = 0.0 98 | self.progressView.alpha = 1.0 99 | }) 100 | }) 101 | }) 102 | } 103 | } 104 | 105 | private func animateView(view: UIView, duration: NSTimeInterval, show: Bool, completion: ((Bool) -> Void)?) 106 | { 107 | let alpha: CGFloat = (show ? 1.0 : 0.0) 108 | 109 | UIView.animateWithDuration(duration, 110 | animations: { 111 | view.alpha = alpha 112 | }, 113 | completion: { (completed) -> Void in 114 | view.hidden = !show 115 | completion?(completed) 116 | }) 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /CircularProgressView/DataLoader.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataLoader.swift 3 | // CircularProgressView 4 | // 5 | // Created by Wagner Truppel on 01/05/2015. 6 | // Copyright (c) 2015 Wagner Truppel. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreGraphics 11 | 12 | 13 | protocol DataLoaderDelegate 14 | { 15 | func dataLoader(dataLoader: DataLoader, didUpdateDataWithPercentValue value: CGFloat) 16 | func dataLoaderDidFinishLoadingData(dataLoader: DataLoader) 17 | } 18 | 19 | 20 | class DataLoader 21 | { 22 | let loaderIndexPath: NSIndexPath 23 | var loaderData: DataItem? 24 | 25 | static func dataSize() -> Int 26 | { return data.count } 27 | 28 | static func loadDataForIndexPath(indexPath: NSIndexPath, delegate: DataLoaderDelegate) 29 | { 30 | let dataLoader = DataLoader(indexPath: indexPath, delegate: delegate) 31 | dataLoader.loadData() 32 | } 33 | 34 | private init(indexPath: NSIndexPath, delegate: DataLoaderDelegate) 35 | { 36 | loaderIndexPath = indexPath 37 | self.delegate = delegate 38 | DataLoader.dataLoaders[indexPath] = self 39 | } 40 | 41 | private static var dataLoaders = [NSIndexPath: DataLoader]() 42 | private var delegate: DataLoaderDelegate? 43 | 44 | private func loadData() 45 | { dispatch_async(globalConcurrentBackgroundQueue) { self.countUp() } } 46 | 47 | private func countUp() 48 | { 49 | let maxCount = Int(CGFloat.randomUniform(a: 300, b: 1000)) 50 | 51 | for count in 0.. dispatch_time_t! 109 | { return dispatch_time(DISPATCH_TIME_NOW, Int64(delayInSeconds * Double(NSEC_PER_SEC))) } 110 | 111 | 112 | // CG extensions 113 | 114 | extension CGFloat 115 | { 116 | // Returns a uniformly distributed random CGFloat in the range [0, 1]. 117 | public static var randomUniform01: CGFloat 118 | { return CGFloat(arc4random_uniform(UInt32.max)) / CGFloat(UInt32.max - 1) } 119 | 120 | // Returns a uniformly distributed random CGFloat in the range [min(a,b), max(a,b)]. 121 | public static func randomUniform(a a: CGFloat, b: CGFloat) -> CGFloat 122 | { return a + (b - a) * CGFloat.randomUniform01 } 123 | 124 | // Returns a uniformly distributed random boolean. 125 | public static var randomBool: Bool 126 | { return CGFloat.randomUniform01 <= 0.5 } 127 | } 128 | -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/120-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/120-1.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/120.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/152.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/180.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/29.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/40.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/58-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/58-1.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/58.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/76.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/80-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/80-1.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/80.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/AppIcon.appiconset/87.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "58-1.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "87.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "80.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "120.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "120-1.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "180.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "29x29", 41 | "idiom" : "ipad", 42 | "filename" : "29.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "29x29", 47 | "idiom" : "ipad", 48 | "filename" : "58.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "40x40", 53 | "idiom" : "ipad", 54 | "filename" : "40.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "40x40", 59 | "idiom" : "ipad", 60 | "filename" : "80-1.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "76x76", 65 | "idiom" : "ipad", 66 | "filename" : "76.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "76x76", 71 | "idiom" : "ipad", 72 | "filename" : "152.png", 73 | "scale" : "2x" 74 | } 75 | ], 76 | "info" : { 77 | "version" : 1, 78 | "author" : "xcode" 79 | } 80 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/arya.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "arya.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "arya@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "arya@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/arya.imageset/arya.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/arya.imageset/arya.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/arya.imageset/arya@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/arya.imageset/arya@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/arya.imageset/arya@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/arya.imageset/arya@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/brienne.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "brienne.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "brienne@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "brienne@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/brienne.imageset/brienne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/brienne.imageset/brienne.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/brienne.imageset/brienne@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/brienne.imageset/brienne@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/brienne.imageset/brienne@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/brienne.imageset/brienne@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/cersei.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "cersei.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "cersei@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "cersei@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/cersei.imageset/cersei.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/cersei.imageset/cersei.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/cersei.imageset/cersei@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/cersei.imageset/cersei@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/cersei.imageset/cersei@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/cersei.imageset/cersei@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/clockwise.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "clockwise.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "clockwise@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "clockwise@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/clockwise.imageset/clockwise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/clockwise.imageset/clockwise.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/clockwise.imageset/clockwise@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/clockwise.imageset/clockwise@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/clockwise.imageset/clockwise@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/clockwise.imageset/clockwise@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/counterclockwise.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "counterclockwise.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "counterclockwise@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "counterclockwise@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/counterclockwise.imageset/counterclockwise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/counterclockwise.imageset/counterclockwise.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/counterclockwise.imageset/counterclockwise@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/counterclockwise.imageset/counterclockwise@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/counterclockwise.imageset/counterclockwise@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/counterclockwise.imageset/counterclockwise@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/danny.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "danny.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "danny@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "danny@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/danny.imageset/danny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/danny.imageset/danny.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/danny.imageset/danny@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/danny.imageset/danny@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/danny.imageset/danny@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/danny.imageset/danny@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/hide_percents.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "hide_percents.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "hide_percents@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "hide_percents@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/hide_percents.imageset/hide_percents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/hide_percents.imageset/hide_percents.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/hide_percents.imageset/hide_percents@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/hide_percents.imageset/hide_percents@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/hide_percents.imageset/hide_percents@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/hide_percents.imageset/hide_percents@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/jaime.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "jaime.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "jaime@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "jaime@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/jaime.imageset/jaime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/jaime.imageset/jaime.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/jaime.imageset/jaime@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/jaime.imageset/jaime@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/jaime.imageset/jaime@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/jaime.imageset/jaime@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/littlefinger.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "littlefinger.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "littlefinger@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "littlefinger@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/littlefinger.imageset/littlefinger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/littlefinger.imageset/littlefinger.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/littlefinger.imageset/littlefinger@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/littlefinger.imageset/littlefinger@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/littlefinger.imageset/littlefinger@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/littlefinger.imageset/littlefinger@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/margie.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "margie.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "margie@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "margie@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/margie.imageset/margie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/margie.imageset/margie.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/margie.imageset/margie@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/margie.imageset/margie@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/margie.imageset/margie@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/margie.imageset/margie@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/ned.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "ned.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "ned@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "ned@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/ned.imageset/ned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/ned.imageset/ned.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/ned.imageset/ned@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/ned.imageset/ned@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/ned.imageset/ned@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/ned.imageset/ned@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/progress_left.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "progress_left.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "progress_left@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "progress_left@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/progress_left.imageset/progress_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/progress_left.imageset/progress_left.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/progress_left.imageset/progress_left@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/progress_left.imageset/progress_left@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/progress_left.imageset/progress_left@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/progress_left.imageset/progress_left@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/progress_made.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "progress_made.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "progress_made@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "progress_made@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/progress_made.imageset/progress_made.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/progress_made.imageset/progress_made.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/progress_made.imageset/progress_made@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/progress_made.imageset/progress_made@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/progress_made.imageset/progress_made@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/progress_made.imageset/progress_made@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/show_percents.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "show_percents.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "show_percents@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "show_percents@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/show_percents.imageset/show_percents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/show_percents.imageset/show_percents.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/show_percents.imageset/show_percents@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/show_percents.imageset/show_percents@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/show_percents.imageset/show_percents@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/show_percents.imageset/show_percents@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/snow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "snow.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "snow@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "snow@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/snow.imageset/snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/snow.imageset/snow.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/snow.imageset/snow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/snow.imageset/snow@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/snow.imageset/snow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/snow.imageset/snow@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/theon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "theon.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "theon@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "theon@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/theon.imageset/theon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/theon.imageset/theon.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/theon.imageset/theon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/theon.imageset/theon@2x.png -------------------------------------------------------------------------------- /CircularProgressView/Images.xcassets/theon.imageset/theon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/CircularProgressView/Images.xcassets/theon.imageset/theon@3x.png -------------------------------------------------------------------------------- /CircularProgressView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.wltruppel.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarHidden 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /CircularProgressView/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CircularProgressView 4 | // 5 | // Created by Wagner Truppel on 26/04/2015. 6 | // Copyright (c) 2015 Wagner Truppel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | class ViewController: UIViewController 13 | { 14 | @IBOutlet weak var tableView: UITableView! 15 | @IBOutlet weak var reloadButton: UIButton! 16 | 17 | private var dataItems = [NSIndexPath: DataItem]() 18 | private var clockwise = true 19 | private var reversed = false 20 | private var showPercs = true 21 | 22 | @IBAction func reloadBtnTapped() 23 | { 24 | reloadButton.enabled = false 25 | dataItems = [NSIndexPath: DataItem]() 26 | tableView.reloadData() 27 | } 28 | 29 | @IBAction func clockwiseBtnTapped(sender: UIButton) 30 | { 31 | sender.selected = !sender.selected 32 | clockwise = !sender.selected 33 | for row in 0.. Int 70 | { return DataLoader.dataSize() } 71 | 72 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell 73 | { 74 | let cell = tableView.dequeueReusableCellWithIdentifier("cellID") as? CustomCell 75 | cell?.dataItem = dataItems[indexPath] 76 | cell?.progressView.clockwise = clockwise 77 | cell?.progressView.reversed = reversed 78 | cell?.progressView.showPercent = showPercs 79 | return cell! 80 | } 81 | 82 | func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, 83 | forRowAtIndexPath indexPath: NSIndexPath) 84 | { 85 | if let customCell = cell as? CustomCell 86 | { 87 | if customCell.dataItem != nil 88 | { customCell.showContent(true, animated: true) } 89 | else 90 | { 91 | customCell.showContent(false, animated: false) 92 | DataLoader.loadDataForIndexPath(indexPath, delegate: self) 93 | } 94 | } 95 | } 96 | } 97 | 98 | 99 | extension ViewController: DataLoaderDelegate 100 | { 101 | func dataLoader(dataLoader: DataLoader, didUpdateDataWithPercentValue value: CGFloat) 102 | { 103 | let cell = tableView.cellForRowAtIndexPath(dataLoader.loaderIndexPath) as? CustomCell 104 | cell?.progressView.value = value 105 | } 106 | 107 | func dataLoaderDidFinishLoadingData(dataLoader: DataLoader) 108 | { 109 | let indexPath = dataLoader.loaderIndexPath 110 | let data = dataLoader.loaderData 111 | 112 | dataItems[indexPath] = data 113 | 114 | let cell = tableView.cellForRowAtIndexPath(indexPath) as? CustomCell 115 | cell?.dataItem = data 116 | 117 | if data != nil { cell?.showContent(true, animated: true) } 118 | 119 | let canReload = (dataItems.count == DataLoader.dataSize()) 120 | reloadButton.enabled = canReload 121 | } 122 | } -------------------------------------------------------------------------------- /IB_rendering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/IB_rendering.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Wagner Truppel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Circular Progress View 2 | A customisable `Swift` class for a progress view similar to what the _Apple Watch_ has. 3 | 4 | ## IMPORTANT 5 | 2016.12.03: This project has been **deprecated** for the time being as it uses Swift 1.2 and I don't intend to update it any time soon. It's still useful as a learning resource but that's about it for now. 6 | 7 | ## Motivation 8 | You may have seen that the _Apple Watch_ has some cool new progress views, like this: 9 | 10 | ![](watch.png) 11 | 12 | Image from [_Apple Watch Human Interface Guidelines_](https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/WatchHumanInterfaceGuidelines/index.html#//apple_ref/doc/uid/TP40014992-CH3-SW1) 13 | 14 | I wanted to create something similar and this project is the result of that effort. 15 | 16 | ## API 17 | 18 | You use a `CircularProgressView` much like you'd use a regular `UIProgressView`. You instantiate a `CircularProgressView` either directly on _Interface Builder_ or programmatically. The class supports IB rendering so when you instantiate it directly on IB, you can manipulate its parameters from an inspector, with immediate feedback. 19 | 20 | ![](IB_rendering.png) 21 | 22 | You can customize: 23 | 24 | * the **track tint**: The color of the full track. 25 | * the **progress tint**: The color of the portion of the track that represents the progress made. 26 | * the **track thickness**: The thickness (in points) of the full track. 27 | * the **progress thickness**: The thickness (in points) of the portion of the track that represents the progress made. There's also another way to set or change the progress thickness but you can only do it programmatically. See the source file for details. 28 | * the **direction of rotation**: Whether the progress track grows clockwise or counterclockwise. 29 | * the **mode of progress**: Whether the view displays the progress itself (_regular_ mode) or what's left of it (_reversed_ mode). 30 | * whether or not to display a label showing the percentage of completion (_regular_ mode) or the percentage of what's left to complete (_reversed_ mode). The label is optional, automatically created if necessary, and you can customise it in many ways. Also, it automatically makes sure that the text is not going to be too large. 31 | * the **percentage tint**: The color of the percentage text shown by the label. 32 | * the **percentage font size**: The font size of the percentage text shown by the label. 33 | * whether or not to display the percentage text using the bold system font (as opposed to the regular system font). Note that although you can't change the actual font of the label through IB, you can do so programmatically by accessing the label and costumising it to your liking. 34 | * the **progress value** displayed by the progress view. This is what you'd play with in IB to see how your other customisation choices feel like. In IB, the values you enter in the inspector are integers interpreted as percentages but, programmatically, you'd set the values using `CGFloat`s in the range [0,1]. 35 | 36 | Of course, being a subclass of `UIView`, you can also customise the progress view's **background color**. 37 | 38 | ## How to install: 39 | 40 | Just copy the source file `CircularProgressView.swift` into your project. That's it. No frameworks. 41 | 42 | ## Requirements: 43 | 44 | I wrote this using **Xcode 6.3 (6D570)** and **Swift 1.2**. 45 | 46 | ## Demo app: 47 | 48 | I've added a demo app showing `CircularProgressView` in action on a typical scenario. All the app does is pretend to download information about characters from _Game of Thrones_. Of course, there's no actual downloading of anything; the data is all hardcoded into the app itself and the app simply counts until some number before it displays the data. Yes, the avatars are ugly. I originally wanted to have images from [this page](http://gameofthrones.wikia.com/wiki/Category:Characters) but then I'd be incurring on copyright violation so I opted for creating them myself. As you can see, I'm a great artist. 49 | 50 | The demo app lets you play with the various options (other than color and thickness) by tapping on the corresponding buttons: **clockwise**/**counterclockwise**, **normal**/**reversed mode**, and **show**/**hide percentage** labels. The **Reload** button, well, reloads everything. The buttons affect all the progress views at once. 51 | 52 | ![](demo_app.png) 53 | 54 | ## Creator 55 | 56 | That would be me, _Wagner Truppel_. If you need or want to contact me, send a message to `wagner` at `restlessbrain` dot com. 57 | 58 | ## License: 59 | 60 | I'm sharing this work under the **MIT License**. See the LICENSE file for more information 61 | -------------------------------------------------------------------------------- /demo_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/demo_app.png -------------------------------------------------------------------------------- /watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wltrup/iOS-Swift-Circular-Progress-View/85c1c15f22975e0e8b989c4a805cc9292a7be43b/watch.png --------------------------------------------------------------------------------