├── .gitignore ├── LICENSE.md ├── ProgressView-SwiftUI ├── ProgressView-SwiftUI.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── ProgressView-SwiftUI │ ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── darkShadow.colorset │ │ └── Contents.json │ ├── dashRing.colorset │ │ └── Contents.json │ ├── lightShadow.colorset │ │ └── Contents.json │ ├── milestone.colorset │ │ └── Contents.json │ └── peach.colorset │ │ └── Contents.json │ ├── ContentView.swift │ ├── Extensions.swift │ ├── Nuemorphic.swift │ ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json │ ├── ProgressView_SwiftUIApp.swift │ └── ProgressViews.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Pratik Gadhesariya 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 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 30011BB3293B5A5C00E5B348 /* Nuemorphic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30011BB2293B5A5C00E5B348 /* Nuemorphic.swift */; }; 11 | 30011BB5293B7AE800E5B348 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30011BB4293B7AE800E5B348 /* Extensions.swift */; }; 12 | 3026AF42292E6B7D006C2EE7 /* ProgressView_SwiftUIApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3026AF41292E6B7D006C2EE7 /* ProgressView_SwiftUIApp.swift */; }; 13 | 3026AF44292E6B7D006C2EE7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3026AF43292E6B7D006C2EE7 /* ContentView.swift */; }; 14 | 3026AF46292E6B82006C2EE7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3026AF45292E6B82006C2EE7 /* Assets.xcassets */; }; 15 | 3026AF49292E6B82006C2EE7 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3026AF48292E6B82006C2EE7 /* Preview Assets.xcassets */; }; 16 | 3026AF50292E6BCA006C2EE7 /* ProgressViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3026AF4F292E6BCA006C2EE7 /* ProgressViews.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 30011BB2293B5A5C00E5B348 /* Nuemorphic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Nuemorphic.swift; sourceTree = ""; }; 21 | 30011BB4293B7AE800E5B348 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; 22 | 3026AF3E292E6B7D006C2EE7 /* ProgressView-SwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ProgressView-SwiftUI.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 3026AF41292E6B7D006C2EE7 /* ProgressView_SwiftUIApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressView_SwiftUIApp.swift; sourceTree = ""; }; 24 | 3026AF43292E6B7D006C2EE7 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 25 | 3026AF45292E6B82006C2EE7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 3026AF48292E6B82006C2EE7 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 27 | 3026AF4F292E6BCA006C2EE7 /* ProgressViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressViews.swift; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | 3026AF3B292E6B7D006C2EE7 /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | ); 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXFrameworksBuildPhase section */ 39 | 40 | /* Begin PBXGroup section */ 41 | 3026AF35292E6B7D006C2EE7 = { 42 | isa = PBXGroup; 43 | children = ( 44 | 3026AF40292E6B7D006C2EE7 /* ProgressView-SwiftUI */, 45 | 3026AF3F292E6B7D006C2EE7 /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | 3026AF3F292E6B7D006C2EE7 /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 3026AF3E292E6B7D006C2EE7 /* ProgressView-SwiftUI.app */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | 3026AF40292E6B7D006C2EE7 /* ProgressView-SwiftUI */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 3026AF41292E6B7D006C2EE7 /* ProgressView_SwiftUIApp.swift */, 61 | 3026AF43292E6B7D006C2EE7 /* ContentView.swift */, 62 | 30011BB2293B5A5C00E5B348 /* Nuemorphic.swift */, 63 | 3026AF4F292E6BCA006C2EE7 /* ProgressViews.swift */, 64 | 30011BB4293B7AE800E5B348 /* Extensions.swift */, 65 | 3026AF45292E6B82006C2EE7 /* Assets.xcassets */, 66 | 3026AF47292E6B82006C2EE7 /* Preview Content */, 67 | ); 68 | path = "ProgressView-SwiftUI"; 69 | sourceTree = ""; 70 | }; 71 | 3026AF47292E6B82006C2EE7 /* Preview Content */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3026AF48292E6B82006C2EE7 /* Preview Assets.xcassets */, 75 | ); 76 | path = "Preview Content"; 77 | sourceTree = ""; 78 | }; 79 | /* End PBXGroup section */ 80 | 81 | /* Begin PBXNativeTarget section */ 82 | 3026AF3D292E6B7D006C2EE7 /* ProgressView-SwiftUI */ = { 83 | isa = PBXNativeTarget; 84 | buildConfigurationList = 3026AF4C292E6B82006C2EE7 /* Build configuration list for PBXNativeTarget "ProgressView-SwiftUI" */; 85 | buildPhases = ( 86 | 3026AF3A292E6B7D006C2EE7 /* Sources */, 87 | 3026AF3B292E6B7D006C2EE7 /* Frameworks */, 88 | 3026AF3C292E6B7D006C2EE7 /* Resources */, 89 | ); 90 | buildRules = ( 91 | ); 92 | dependencies = ( 93 | ); 94 | name = "ProgressView-SwiftUI"; 95 | productName = "ProgressView-SwiftUI"; 96 | productReference = 3026AF3E292E6B7D006C2EE7 /* ProgressView-SwiftUI.app */; 97 | productType = "com.apple.product-type.application"; 98 | }; 99 | /* End PBXNativeTarget section */ 100 | 101 | /* Begin PBXProject section */ 102 | 3026AF36292E6B7D006C2EE7 /* Project object */ = { 103 | isa = PBXProject; 104 | attributes = { 105 | BuildIndependentTargetsInParallel = 1; 106 | LastSwiftUpdateCheck = 1340; 107 | LastUpgradeCheck = 1340; 108 | TargetAttributes = { 109 | 3026AF3D292E6B7D006C2EE7 = { 110 | CreatedOnToolsVersion = 13.4.1; 111 | }; 112 | }; 113 | }; 114 | buildConfigurationList = 3026AF39292E6B7D006C2EE7 /* Build configuration list for PBXProject "ProgressView-SwiftUI" */; 115 | compatibilityVersion = "Xcode 13.0"; 116 | developmentRegion = en; 117 | hasScannedForEncodings = 0; 118 | knownRegions = ( 119 | en, 120 | Base, 121 | ); 122 | mainGroup = 3026AF35292E6B7D006C2EE7; 123 | productRefGroup = 3026AF3F292E6B7D006C2EE7 /* Products */; 124 | projectDirPath = ""; 125 | projectRoot = ""; 126 | targets = ( 127 | 3026AF3D292E6B7D006C2EE7 /* ProgressView-SwiftUI */, 128 | ); 129 | }; 130 | /* End PBXProject section */ 131 | 132 | /* Begin PBXResourcesBuildPhase section */ 133 | 3026AF3C292E6B7D006C2EE7 /* Resources */ = { 134 | isa = PBXResourcesBuildPhase; 135 | buildActionMask = 2147483647; 136 | files = ( 137 | 3026AF49292E6B82006C2EE7 /* Preview Assets.xcassets in Resources */, 138 | 3026AF46292E6B82006C2EE7 /* Assets.xcassets in Resources */, 139 | ); 140 | runOnlyForDeploymentPostprocessing = 0; 141 | }; 142 | /* End PBXResourcesBuildPhase section */ 143 | 144 | /* Begin PBXSourcesBuildPhase section */ 145 | 3026AF3A292E6B7D006C2EE7 /* Sources */ = { 146 | isa = PBXSourcesBuildPhase; 147 | buildActionMask = 2147483647; 148 | files = ( 149 | 30011BB5293B7AE800E5B348 /* Extensions.swift in Sources */, 150 | 3026AF44292E6B7D006C2EE7 /* ContentView.swift in Sources */, 151 | 30011BB3293B5A5C00E5B348 /* Nuemorphic.swift in Sources */, 152 | 3026AF50292E6BCA006C2EE7 /* ProgressViews.swift in Sources */, 153 | 3026AF42292E6B7D006C2EE7 /* ProgressView_SwiftUIApp.swift in Sources */, 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | /* End PBXSourcesBuildPhase section */ 158 | 159 | /* Begin XCBuildConfiguration section */ 160 | 3026AF4A292E6B82006C2EE7 /* Debug */ = { 161 | isa = XCBuildConfiguration; 162 | buildSettings = { 163 | ALWAYS_SEARCH_USER_PATHS = NO; 164 | CLANG_ANALYZER_NONNULL = YES; 165 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 166 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 167 | CLANG_ENABLE_MODULES = YES; 168 | CLANG_ENABLE_OBJC_ARC = YES; 169 | CLANG_ENABLE_OBJC_WEAK = YES; 170 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 171 | CLANG_WARN_BOOL_CONVERSION = YES; 172 | CLANG_WARN_COMMA = YES; 173 | CLANG_WARN_CONSTANT_CONVERSION = YES; 174 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 175 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 176 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 177 | CLANG_WARN_EMPTY_BODY = YES; 178 | CLANG_WARN_ENUM_CONVERSION = YES; 179 | CLANG_WARN_INFINITE_RECURSION = YES; 180 | CLANG_WARN_INT_CONVERSION = YES; 181 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 182 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 183 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 184 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 185 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 186 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 187 | CLANG_WARN_STRICT_PROTOTYPES = YES; 188 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 189 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 190 | CLANG_WARN_UNREACHABLE_CODE = YES; 191 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 192 | COPY_PHASE_STRIP = NO; 193 | DEBUG_INFORMATION_FORMAT = dwarf; 194 | ENABLE_STRICT_OBJC_MSGSEND = YES; 195 | ENABLE_TESTABILITY = YES; 196 | GCC_C_LANGUAGE_STANDARD = gnu11; 197 | GCC_DYNAMIC_NO_PIC = NO; 198 | GCC_NO_COMMON_BLOCKS = YES; 199 | GCC_OPTIMIZATION_LEVEL = 0; 200 | GCC_PREPROCESSOR_DEFINITIONS = ( 201 | "DEBUG=1", 202 | "$(inherited)", 203 | ); 204 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 205 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 206 | GCC_WARN_UNDECLARED_SELECTOR = YES; 207 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 208 | GCC_WARN_UNUSED_FUNCTION = YES; 209 | GCC_WARN_UNUSED_VARIABLE = YES; 210 | IPHONEOS_DEPLOYMENT_TARGET = 15.5; 211 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 212 | MTL_FAST_MATH = YES; 213 | ONLY_ACTIVE_ARCH = YES; 214 | SDKROOT = iphoneos; 215 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 216 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 217 | }; 218 | name = Debug; 219 | }; 220 | 3026AF4B292E6B82006C2EE7 /* Release */ = { 221 | isa = XCBuildConfiguration; 222 | buildSettings = { 223 | ALWAYS_SEARCH_USER_PATHS = NO; 224 | CLANG_ANALYZER_NONNULL = YES; 225 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 226 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 227 | CLANG_ENABLE_MODULES = YES; 228 | CLANG_ENABLE_OBJC_ARC = YES; 229 | CLANG_ENABLE_OBJC_WEAK = YES; 230 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 231 | CLANG_WARN_BOOL_CONVERSION = YES; 232 | CLANG_WARN_COMMA = YES; 233 | CLANG_WARN_CONSTANT_CONVERSION = YES; 234 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 235 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 236 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 237 | CLANG_WARN_EMPTY_BODY = YES; 238 | CLANG_WARN_ENUM_CONVERSION = YES; 239 | CLANG_WARN_INFINITE_RECURSION = YES; 240 | CLANG_WARN_INT_CONVERSION = YES; 241 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 242 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 243 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 244 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 245 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 246 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 247 | CLANG_WARN_STRICT_PROTOTYPES = YES; 248 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 249 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 250 | CLANG_WARN_UNREACHABLE_CODE = YES; 251 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 252 | COPY_PHASE_STRIP = NO; 253 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 254 | ENABLE_NS_ASSERTIONS = NO; 255 | ENABLE_STRICT_OBJC_MSGSEND = YES; 256 | GCC_C_LANGUAGE_STANDARD = gnu11; 257 | GCC_NO_COMMON_BLOCKS = YES; 258 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 259 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 260 | GCC_WARN_UNDECLARED_SELECTOR = YES; 261 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 262 | GCC_WARN_UNUSED_FUNCTION = YES; 263 | GCC_WARN_UNUSED_VARIABLE = YES; 264 | IPHONEOS_DEPLOYMENT_TARGET = 15.5; 265 | MTL_ENABLE_DEBUG_INFO = NO; 266 | MTL_FAST_MATH = YES; 267 | SDKROOT = iphoneos; 268 | SWIFT_COMPILATION_MODE = wholemodule; 269 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 270 | VALIDATE_PRODUCT = YES; 271 | }; 272 | name = Release; 273 | }; 274 | 3026AF4D292E6B82006C2EE7 /* Debug */ = { 275 | isa = XCBuildConfiguration; 276 | buildSettings = { 277 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 278 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 279 | CODE_SIGN_STYLE = Automatic; 280 | CURRENT_PROJECT_VERSION = 1; 281 | DEVELOPMENT_ASSET_PATHS = "\"ProgressView-SwiftUI/Preview Content\""; 282 | ENABLE_PREVIEWS = YES; 283 | GENERATE_INFOPLIST_FILE = YES; 284 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 285 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 286 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 287 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 288 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 289 | LD_RUNPATH_SEARCH_PATHS = ( 290 | "$(inherited)", 291 | "@executable_path/Frameworks", 292 | ); 293 | MARKETING_VERSION = 1.0; 294 | PRODUCT_BUNDLE_IDENTIFIER = "com.pratik.ProgressView-SwiftUI"; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | SWIFT_EMIT_LOC_STRINGS = YES; 297 | SWIFT_VERSION = 5.0; 298 | TARGETED_DEVICE_FAMILY = "1,2"; 299 | }; 300 | name = Debug; 301 | }; 302 | 3026AF4E292E6B82006C2EE7 /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 306 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 307 | CODE_SIGN_STYLE = Automatic; 308 | CURRENT_PROJECT_VERSION = 1; 309 | DEVELOPMENT_ASSET_PATHS = "\"ProgressView-SwiftUI/Preview Content\""; 310 | ENABLE_PREVIEWS = YES; 311 | GENERATE_INFOPLIST_FILE = YES; 312 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 313 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 314 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 315 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 316 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 317 | LD_RUNPATH_SEARCH_PATHS = ( 318 | "$(inherited)", 319 | "@executable_path/Frameworks", 320 | ); 321 | MARKETING_VERSION = 1.0; 322 | PRODUCT_BUNDLE_IDENTIFIER = "com.pratik.ProgressView-SwiftUI"; 323 | PRODUCT_NAME = "$(TARGET_NAME)"; 324 | SWIFT_EMIT_LOC_STRINGS = YES; 325 | SWIFT_VERSION = 5.0; 326 | TARGETED_DEVICE_FAMILY = "1,2"; 327 | }; 328 | name = Release; 329 | }; 330 | /* End XCBuildConfiguration section */ 331 | 332 | /* Begin XCConfigurationList section */ 333 | 3026AF39292E6B7D006C2EE7 /* Build configuration list for PBXProject "ProgressView-SwiftUI" */ = { 334 | isa = XCConfigurationList; 335 | buildConfigurations = ( 336 | 3026AF4A292E6B82006C2EE7 /* Debug */, 337 | 3026AF4B292E6B82006C2EE7 /* Release */, 338 | ); 339 | defaultConfigurationIsVisible = 0; 340 | defaultConfigurationName = Release; 341 | }; 342 | 3026AF4C292E6B82006C2EE7 /* Build configuration list for PBXNativeTarget "ProgressView-SwiftUI" */ = { 343 | isa = XCConfigurationList; 344 | buildConfigurations = ( 345 | 3026AF4D292E6B82006C2EE7 /* Debug */, 346 | 3026AF4E292E6B82006C2EE7 /* Release */, 347 | ); 348 | defaultConfigurationIsVisible = 0; 349 | defaultConfigurationName = Release; 350 | }; 351 | /* End XCConfigurationList section */ 352 | }; 353 | rootObject = 3026AF36292E6B7D006C2EE7 /* Project object */; 354 | } 355 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Assets.xcassets/darkShadow.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "gray-gamma-22", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "white" : "0.600" 9 | } 10 | }, 11 | "idiom" : "universal" 12 | }, 13 | { 14 | "appearances" : [ 15 | { 16 | "appearance" : "luminosity", 17 | "value" : "dark" 18 | } 19 | ], 20 | "color" : { 21 | "color-space" : "gray-gamma-22", 22 | "components" : { 23 | "alpha" : "1.000", 24 | "white" : "0.300" 25 | } 26 | }, 27 | "idiom" : "universal" 28 | } 29 | ], 30 | "info" : { 31 | "author" : "xcode", 32 | "version" : 1 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Assets.xcassets/dashRing.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0.969", 9 | "green" : "0.616", 10 | "red" : "0.373" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "0.969", 27 | "green" : "0.616", 28 | "red" : "0.373" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Assets.xcassets/lightShadow.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "gray-gamma-22", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "white" : "1.000" 9 | } 10 | }, 11 | "idiom" : "universal" 12 | }, 13 | { 14 | "appearances" : [ 15 | { 16 | "appearance" : "luminosity", 17 | "value" : "dark" 18 | } 19 | ], 20 | "color" : { 21 | "color-space" : "gray-gamma-22", 22 | "components" : { 23 | "alpha" : "1.000", 24 | "white" : "0.000" 25 | } 26 | }, 27 | "idiom" : "universal" 28 | } 29 | ], 30 | "info" : { 31 | "author" : "xcode", 32 | "version" : 1 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Assets.xcassets/milestone.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0.000", 9 | "green" : "0.749", 10 | "red" : "1.000" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "0.000", 27 | "green" : "0.749", 28 | "red" : "1.000" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Assets.xcassets/peach.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0.467", 9 | "green" : "0.467", 10 | "red" : "0.808" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "0.467", 27 | "green" : "0.467", 28 | "red" : "0.808" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // ProgressView-SwiftUI 4 | // 5 | // Created by Pratik on 23/11/22. 6 | // 7 | 8 | import SwiftUI 9 | 10 | let bgColor = Color(uiColor: .systemGroupedBackground) //Color(white: 0.95) 11 | let cellColor = Color(uiColor: .secondarySystemGroupedBackground) //Color.white 12 | 13 | struct ContentView: View { 14 | @State private var progress: CGFloat = 0.3 15 | var body: some View { 16 | ZStack { 17 | // Color(white: 0.95) 18 | bgColor 19 | .ignoresSafeArea() 20 | ScrollView(.vertical, showsIndicators: false) { 21 | LazyVGrid(columns: [GridItem(.adaptive(minimum: 150), spacing: 20, alignment: .center)], 22 | alignment: .center, 23 | spacing: 20, 24 | pinnedViews: []) { 25 | CellView { 26 | RingProgressView(progress: progress) 27 | } 28 | 29 | CellView { 30 | CircularProgressView(progress: progress) 31 | } 32 | 33 | CellView { 34 | RingDashProgressView(progress: progress) 35 | } 36 | 37 | CellView { 38 | LoadingProgressView(progress: progress) 39 | } 40 | 41 | CellView { 42 | SimpleBarProgressView(progress: progress) 43 | .frame(height: 30) 44 | } 45 | 46 | CellView { 47 | MilestoneProgressView(progress: progress) 48 | .frame(height: 30) 49 | } 50 | 51 | CellView { 52 | NuemorphicRing(progress: progress) 53 | } 54 | 55 | CellView { 56 | NuemorphicCircleButton(progress: progress) 57 | } 58 | } 59 | } 60 | .padding(.horizontal) 61 | 62 | VStack { 63 | Spacer() 64 | 65 | Slider(value: $progress, in: 0...1) 66 | .padding() 67 | .background(RoundedRectangle(cornerRadius: 20, style: .continuous).fill(cellColor)) 68 | .padding(.horizontal) 69 | } 70 | } 71 | } 72 | } 73 | 74 | struct CellView: View { 75 | let content: () -> Content 76 | var body: some View { 77 | content() 78 | .aspectRatio(1, contentMode: .fit) 79 | .padding(20) 80 | .background( 81 | RoundedRectangle(cornerRadius: 20, style: .continuous) 82 | .fill(cellColor) 83 | ) 84 | } 85 | } 86 | 87 | struct ContentView_Previews: PreviewProvider { 88 | static var previews: some View { 89 | ContentView() 90 | .preferredColorScheme(.light) 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extensions.swift 3 | // ProgressView-SwiftUI 4 | // 5 | // Created by Pratik on 03/12/22. 6 | // 7 | 8 | import UIKit 9 | 10 | extension Array where Element: UIColor { 11 | func intermediate(percentage: CGFloat) -> UIColor { 12 | let percentage = Swift.max(Swift.min(percentage, 100), 0) / 100 13 | switch percentage { 14 | case 0: return first ?? .clear 15 | case 1: return last ?? .clear 16 | default: 17 | let approxIndex = percentage / (1 / CGFloat(count - 1)) 18 | let firstIndex = Int(approxIndex.rounded(.down)) 19 | let secondIndex = Int(approxIndex.rounded(.up)) 20 | let fallbackIndex = Int(approxIndex.rounded()) 21 | 22 | let firstColor = self[firstIndex] 23 | let secondColor = self[secondIndex] 24 | let fallbackColor = self[fallbackIndex] 25 | 26 | var (r1, g1, b1, a1): (CGFloat, CGFloat, CGFloat, CGFloat) = (0, 0, 0, 0) 27 | var (r2, g2, b2, a2): (CGFloat, CGFloat, CGFloat, CGFloat) = (0, 0, 0, 0) 28 | guard firstColor.getRed(&r1, green: &g1, blue: &b1, alpha: &a1) else { return fallbackColor } 29 | guard secondColor.getRed(&r2, green: &g2, blue: &b2, alpha: &a2) else { return fallbackColor } 30 | 31 | let intermediatePercentage = approxIndex - CGFloat(firstIndex) 32 | return UIColor( 33 | red: CGFloat(r1 + (r2 - r1) * intermediatePercentage), 34 | green: CGFloat(g1 + (g2 - g1) * intermediatePercentage), 35 | blue: CGFloat(b1 + (b2 - b1) * intermediatePercentage), 36 | alpha: CGFloat(a1 + (a2 - a1) * intermediatePercentage) 37 | ) 38 | } 39 | } 40 | } 41 | 42 | 43 | extension UIColor { 44 | private func makeColor(componentDelta: CGFloat) -> UIColor { 45 | var red: CGFloat = 0 46 | var blue: CGFloat = 0 47 | var green: CGFloat = 0 48 | var alpha: CGFloat = 0 49 | 50 | // Extract r,g,b,a components from the 51 | // current UIColor 52 | getRed( 53 | &red, 54 | green: &green, 55 | blue: &blue, 56 | alpha: &alpha 57 | ) 58 | 59 | // Create a new UIColor modifying each component 60 | // by componentDelta, making the new UIColor either 61 | // lighter or darker. 62 | return UIColor( 63 | red: add(componentDelta, toComponent: red), 64 | green: add(componentDelta, toComponent: green), 65 | blue: add(componentDelta, toComponent: blue), 66 | alpha: alpha 67 | ) 68 | } 69 | 70 | // Add value to component ensuring the result is 71 | // between 0 and 1 72 | private func add(_ value: CGFloat, toComponent: CGFloat) -> CGFloat { 73 | return max(0, min(1, toComponent + value)) 74 | } 75 | 76 | func lighter(componentDelta: CGFloat = 0.1) -> UIColor { 77 | return makeColor(componentDelta: componentDelta) 78 | } 79 | 80 | func darker(componentDelta: CGFloat = 0.1) -> UIColor { 81 | return makeColor(componentDelta: -1*componentDelta) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Nuemorphic.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Nuemorphic.swift 3 | // ProgressView-SwiftUI 4 | // 5 | // Created by Pratik on 03/12/22. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct NuemorphicRing: View { 11 | var progress: CGFloat 12 | 13 | var fillColor: Color = .purple 14 | var otherColor: Color = cellColor 15 | 16 | var body: some View { 17 | ZStack { 18 | Circle() 19 | .stroke(lineWidth: 20) 20 | .foregroundColor(Color("lightShadow")) 21 | .shadow(color: Color("darkShadow"), radius: 10, x: 10, y: 10) 22 | .shadow(color: Color("lightShadow"), radius: 10, x: -10, y: -10) 23 | .padding(10) 24 | 25 | Circle() 26 | .fill(Color("lightShadow")) 27 | .shadow(color: Color("darkShadow"), radius: 10, x: 10, y: 10) 28 | .shadow(color: Color("lightShadow"), radius: 10, x: -10, y: -10) 29 | .padding(20 + 15) 30 | 31 | Circle() 32 | .trim(from: 0, to: progress) 33 | .stroke(style: StrokeStyle(lineWidth: 15, lineCap: .round)) 34 | .foregroundColor(fillColor) 35 | .padding(7.5 + 20) 36 | .rotationEffect(.degrees(-90)) 37 | } 38 | } 39 | } 40 | 41 | 42 | struct NuemorphicCircleButton: View { 43 | var progress: CGFloat 44 | 45 | let colors: [UIColor] = [.orange, .white, .cyan] 46 | 47 | var body: some View { 48 | GeometryReader { bounds in 49 | ZStack { 50 | Circle() 51 | .trim(from: 0, to: 0.5) 52 | .stroke(style: StrokeStyle(lineWidth: 7, lineCap: .round)) 53 | .foregroundStyle(AngularGradient(colors: [.orange, .white, .teal], center: .center, startAngle: .degrees(0), endAngle: .degrees(180))) 54 | .padding(3.5) 55 | 56 | Circle() 57 | .fill(Color.white) 58 | .overlay { 59 | Circle() 60 | .fill(Color(uiColor: colors.intermediate(percentage: progress*100))) 61 | .opacity(0.6) 62 | .overlay { 63 | Capsule() 64 | .fill(.black) 65 | .frame(width: 14, height: 5, alignment: .center) 66 | .offset(x: (bounds.size.width/2) - 32) 67 | } 68 | } 69 | .padding(20) 70 | .shadow(color: Color("darkShadow"), radius: 10, x: 0, y: 0) 71 | .rotationEffect(.degrees(progressAngle())) 72 | } 73 | .rotationEffect(.degrees(180)) 74 | } 75 | } 76 | 77 | private func progressAngle() -> Double { 78 | Double(180) * progress 79 | } 80 | } 81 | 82 | struct Nuemorphic_Previews: PreviewProvider { 83 | static var previews: some View { 84 | ZStack { 85 | cellColor 86 | .ignoresSafeArea() 87 | NuemorphicCircleButton(progress: 0.3) 88 | .frame(width: 150, height: 150, alignment: .center) 89 | } 90 | .preferredColorScheme(.dark) 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/ProgressView_SwiftUIApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressView_SwiftUIApp.swift 3 | // ProgressView-SwiftUI 4 | // 5 | // Created by Pratik on 23/11/22. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct ProgressView_SwiftUIApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ProgressView-SwiftUI/ProgressView-SwiftUI/ProgressViews.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressViews.swift 3 | // ProgressView-SwiftUI 4 | // 5 | // Created by Pratik on 23/11/22. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct SimpleBarProgressView: View { 11 | let progress: CGFloat 12 | 13 | private let bgColor = Color.green.opacity(0.2) 14 | private let fillColor = Color.green 15 | 16 | var body: some View { 17 | VStack { 18 | GeometryReader { bounds in 19 | Capsule(style: .circular) 20 | .fill(bgColor) 21 | .overlay { 22 | HStack { 23 | Capsule(style: .circular) 24 | .fill(fillColor) 25 | .frame(width: bounds.size.width * progress) 26 | 27 | Spacer(minLength: 0) 28 | } 29 | } 30 | .clipShape(Capsule(style: .circular)) 31 | } 32 | .frame(height: 15) 33 | } 34 | } 35 | } 36 | 37 | 38 | struct RingProgressView: View { 39 | let progress: CGFloat 40 | 41 | private let bgColor = Color.orange.opacity(0.2) 42 | private let fillColor = Color.orange 43 | 44 | var body: some View { 45 | Circle() 46 | .stroke(style: StrokeStyle(lineWidth: 40)) 47 | .foregroundColor(bgColor) 48 | .overlay { 49 | Circle() 50 | .trim(from: 0, to: progress) 51 | .stroke(style: StrokeStyle(lineWidth: 40)) 52 | .foregroundStyle(AngularGradient(colors: [fillColor, fillColor.opacity(0.5)], center: .center)) 53 | } 54 | .rotationEffect(.degrees(-90)) 55 | .clipShape(Circle()) 56 | } 57 | } 58 | 59 | struct CircularProgressView: View { 60 | let progress: CGFloat 61 | 62 | private let bgColor = Color.teal.opacity(0.2) 63 | private let fillColor = Color.teal 64 | 65 | var body: some View { 66 | Circle() 67 | .fill(bgColor) 68 | .overlay { 69 | FilledCircleShape(progress: progress) 70 | .fill(AngularGradient(colors: [fillColor, fillColor.opacity(0.5)], center: .center)) 71 | .rotationEffect(.degrees(-90)) 72 | } 73 | } 74 | 75 | struct FilledCircleShape: Shape { 76 | var progress: Double 77 | 78 | func path(in rect: CGRect) -> Path { 79 | var path = Path() 80 | 81 | let center = CGPoint(x: rect.midX, y: rect.midY) 82 | 83 | path.move(to: CGPoint(x: rect.maxX, y: rect.midY)) 84 | path.addArc(center: center, radius: rect.width/2, startAngle: .degrees(0), endAngle: .degrees((360*progress)), clockwise: false) 85 | path.addLine(to: center) 86 | path.addLine(to: CGPoint(x: rect.maxX, y: rect.midY)) 87 | return path 88 | } 89 | } 90 | } 91 | 92 | struct RingDashProgressView: View { 93 | let progress: CGFloat 94 | 95 | private let bgColor = Color("dashRing").opacity(0.2) 96 | private let fillColor = Color("dashRing") 97 | 98 | var body: some View { 99 | Circle() 100 | .stroke(style: StrokeStyle(lineWidth: 50, lineCap: .butt, miterLimit: 0, dash: [10, 5], dashPhase: 0)) 101 | .foregroundColor(bgColor) 102 | .overlay { 103 | Circle() 104 | .trim(from: 0, to: progress) 105 | .stroke(style: StrokeStyle(lineWidth: 50, lineCap: .butt, miterLimit: 0, dash: [10, 5], dashPhase: 0)) 106 | .foregroundColor(fillColor) 107 | } 108 | .rotationEffect(.degrees(-90)) 109 | .clipShape(Circle()) 110 | } 111 | } 112 | 113 | 114 | struct LoadingProgressView: View { 115 | var progress: CGFloat 116 | 117 | @State var rotationAngle: Double = 0 118 | var fillColor: Color = .red 119 | var count: Int = 20 120 | 121 | var body: some View { 122 | GeometryReader { bounds in 123 | ZStack { 124 | ForEach(0.. CGFloat { 148 | CGFloat(index) 149 | } 150 | } 151 | 152 | struct MilestoneProgressView: View { 153 | 154 | var progress: CGFloat 155 | private var count: Float = 3 156 | private var radius: CGFloat = 10 157 | private var lineWidth: CGFloat = 8 158 | private var color = Color("milestone") 159 | 160 | init(progress: CGFloat) { 161 | self.progress = progress 162 | } 163 | 164 | var body: some View { 165 | GeometryReader { bounds in 166 | VStack(spacing: 70) { 167 | MilestoneShape(count: Int(count), radius: radius) 168 | .stroke(lineWidth: lineWidth) 169 | .foregroundColor(color.opacity(0.3)) 170 | .padding(.horizontal, lineWidth/2) 171 | .overlay { 172 | MilestoneShape(count: Int(count), radius: radius) 173 | .stroke(lineWidth: lineWidth) 174 | .foregroundColor(color) 175 | .padding(.horizontal, lineWidth/2) 176 | .mask( 177 | HStack { 178 | Rectangle() 179 | 180 | .frame(width: bounds.size.width * progress, alignment: .leading) 181 | Spacer(minLength: 0) 182 | } 183 | ) 184 | } 185 | .padding(.horizontal, lineWidth/2) 186 | } 187 | } 188 | } 189 | 190 | struct MilestoneShape: Shape { 191 | let count: Int 192 | let radius: CGFloat 193 | 194 | func path(in rect: CGRect) -> Path { 195 | var path = Path() 196 | 197 | path.move(to: CGPoint(x: 0, y: rect.midY)) 198 | 199 | var maxX: CGFloat = 0 200 | let remainingSpace: CGFloat = rect.width - (CGFloat(count)*radius*2) 201 | let lineLength: CGFloat = remainingSpace / CGFloat(count - 1) 202 | 203 | for i in 1...count { 204 | path.addEllipse(in: CGRect(origin: CGPoint(x: maxX, y: rect.midY - radius), size: CGSize(width: radius*2, height: radius*2))) 205 | maxX += radius*2 206 | path.move(to: CGPoint(x: maxX, y: rect.midY)) 207 | if i != count { 208 | maxX += lineLength 209 | path.addLine(to: CGPoint(x: maxX, y: rect.midY)) 210 | } 211 | } 212 | 213 | return path 214 | } 215 | } 216 | } 217 | 218 | 219 | 220 | 221 | 222 | struct TestView_Previews: PreviewProvider { 223 | static var previews: some View { 224 | ContentView() 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProgressViews-SwiftUI 2 | 3 | Created some cool and attractive progress views in SwiftUI. 4 | 5 | Support me: 6 | 7 | Buy Me A Coffee 8 | 9 | https://www.paypal.com/paypalme/PratikGadhesariya 10 | 11 | ![Image 3](https://user-images.githubusercontent.com/35287467/205444364-657e77e7-adeb-449f-9383-3fef6d41976a.png) 12 | 13 | 14 | 15 | https://user-images.githubusercontent.com/35287467/205444430-7984a3cf-e770-4475-8ea2-c1c6b5f443dc.mov 16 | 17 | --------------------------------------------------------------------------------