├── .gitignore ├── .swiftlint.yml ├── .travis.yml ├── Cartfile ├── Cartfile.private ├── Cartfile.resolved ├── DEMO ├── KRProgressHUDDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── KRProgressHUDDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── KRProgressHUDDemo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── SceneDelegate.swift │ ├── ViewController.swift │ └── image.png ├── Podfile └── Podfile.lock ├── KRProgressHUD.podspec ├── KRProgressHUD.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── KRProgressHUD.xcscheme ├── KRProgressHUD ├── Classes │ ├── Extensions.swift │ ├── InnerKRProgressHUD.swift │ ├── KRProgressHUD.swift │ ├── KRProgressHUDIconType.swift │ └── KRProgressHUDViewController.swift ├── Info.plist ├── KRProgressHUD.h └── PrivacyInfo.xcprivacy ├── KRProgressHUDTests ├── Info.plist └── KRProgressHUDTests.swift ├── LICENSE ├── Package.swift ├── README.md └── README_Ja.md /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage/ 26 | Pods/ 27 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - line_length 3 | - file_length 4 | included: 5 | - KRProgressHUD 6 | excluded: 7 | - Pods 8 | type_body_length: 9 | - 400 # warning 10 | - 500 # error 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode15 3 | xcode_sdk: iphonesimulator17.0 4 | install: 5 | - gem install xcpretty 6 | - carthage bootstrap --platform iOS 7 | script: 8 | - set -o pipefail 9 | - travis_retry xcodebuild -project KRProgressHUD.xcodeproj -scheme KRProgressHUD -destination "platform=iOS Simulator,name=iPhone Xs" build-for-testing test | xcpretty 10 | notifications: 11 | email: false 12 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "krimpedance/KRActivityIndicatorView" == 3.0.8 2 | -------------------------------------------------------------------------------- /Cartfile.private: -------------------------------------------------------------------------------- 1 | github "Quick/Quick" 2 | github "Quick/Nimble" 3 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "Quick/Nimble" "v13.2.1" 2 | github "Quick/Quick" "v7.4.1" 3 | github "krimpedance/KRActivityIndicatorView" "3.0.8" 4 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 63; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6B76305D23350D0300B7FE9B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B76305C23350D0300B7FE9B /* AppDelegate.swift */; }; 11 | 6B76305F23350D0300B7FE9B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B76305E23350D0300B7FE9B /* SceneDelegate.swift */; }; 12 | 6B76306123350D0300B7FE9B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B76306023350D0300B7FE9B /* ViewController.swift */; }; 13 | 6B76306423350D0300B7FE9B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B76306223350D0300B7FE9B /* Main.storyboard */; }; 14 | 6B76306623350D0500B7FE9B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B76306523350D0500B7FE9B /* Assets.xcassets */; }; 15 | 6B76306923350D0500B7FE9B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B76306723350D0500B7FE9B /* LaunchScreen.storyboard */; }; 16 | 6B76307123350E8200B7FE9B /* image.png in Resources */ = {isa = PBXBuildFile; fileRef = 6B76307023350E8100B7FE9B /* image.png */; }; 17 | C1AF61C2CDCD5EAE1AA2F4EC /* Pods_KRProgressHUDDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 700B101137FE083F45BE1F94 /* Pods_KRProgressHUDDemo.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 6B76305923350D0300B7FE9B /* KRProgressHUDDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KRProgressHUDDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 6B76305C23350D0300B7FE9B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | 6B76305E23350D0300B7FE9B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 24 | 6B76306023350D0300B7FE9B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 25 | 6B76306323350D0300B7FE9B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 26 | 6B76306523350D0500B7FE9B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | 6B76306823350D0500B7FE9B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | 6B76306A23350D0500B7FE9B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 6B76307023350E8100B7FE9B /* image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image.png; sourceTree = ""; }; 30 | 700B101137FE083F45BE1F94 /* Pods_KRProgressHUDDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KRProgressHUDDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 994DC6EFFEA4B215AAD5F34F /* Pods-KRProgressHUDDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KRProgressHUDDemo.debug.xcconfig"; path = "Target Support Files/Pods-KRProgressHUDDemo/Pods-KRProgressHUDDemo.debug.xcconfig"; sourceTree = ""; }; 32 | 9DF5449C0CD963C59EE7D6BE /* Pods-KRProgressHUDDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KRProgressHUDDemo.release.xcconfig"; path = "Target Support Files/Pods-KRProgressHUDDemo/Pods-KRProgressHUDDemo.release.xcconfig"; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 6B76305623350D0300B7FE9B /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | C1AF61C2CDCD5EAE1AA2F4EC /* Pods_KRProgressHUDDemo.framework in Frameworks */, 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 1ECD73C341F5E9EC0A67B67D /* Pods */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 994DC6EFFEA4B215AAD5F34F /* Pods-KRProgressHUDDemo.debug.xcconfig */, 51 | 9DF5449C0CD963C59EE7D6BE /* Pods-KRProgressHUDDemo.release.xcconfig */, 52 | ); 53 | path = Pods; 54 | sourceTree = ""; 55 | }; 56 | 3B809754B1CFE11D7D4A7D07 /* Frameworks */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 700B101137FE083F45BE1F94 /* Pods_KRProgressHUDDemo.framework */, 60 | ); 61 | name = Frameworks; 62 | sourceTree = ""; 63 | }; 64 | 6B76305023350D0300B7FE9B = { 65 | isa = PBXGroup; 66 | children = ( 67 | 6B76305B23350D0300B7FE9B /* KRProgressHUDDemo */, 68 | 6B76305A23350D0300B7FE9B /* Products */, 69 | 1ECD73C341F5E9EC0A67B67D /* Pods */, 70 | 3B809754B1CFE11D7D4A7D07 /* Frameworks */, 71 | ); 72 | sourceTree = ""; 73 | }; 74 | 6B76305A23350D0300B7FE9B /* Products */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 6B76305923350D0300B7FE9B /* KRProgressHUDDemo.app */, 78 | ); 79 | name = Products; 80 | sourceTree = ""; 81 | }; 82 | 6B76305B23350D0300B7FE9B /* KRProgressHUDDemo */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 6B76305C23350D0300B7FE9B /* AppDelegate.swift */, 86 | 6B76305E23350D0300B7FE9B /* SceneDelegate.swift */, 87 | 6B76306023350D0300B7FE9B /* ViewController.swift */, 88 | 6B76306223350D0300B7FE9B /* Main.storyboard */, 89 | 6B76306523350D0500B7FE9B /* Assets.xcassets */, 90 | 6B76306723350D0500B7FE9B /* LaunchScreen.storyboard */, 91 | 6B76306A23350D0500B7FE9B /* Info.plist */, 92 | 6B76307023350E8100B7FE9B /* image.png */, 93 | ); 94 | path = KRProgressHUDDemo; 95 | sourceTree = ""; 96 | }; 97 | /* End PBXGroup section */ 98 | 99 | /* Begin PBXNativeTarget section */ 100 | 6B76305823350D0300B7FE9B /* KRProgressHUDDemo */ = { 101 | isa = PBXNativeTarget; 102 | buildConfigurationList = 6B76306D23350D0500B7FE9B /* Build configuration list for PBXNativeTarget "KRProgressHUDDemo" */; 103 | buildPhases = ( 104 | EA5DB11A0B3644984D84FC43 /* [CP] Check Pods Manifest.lock */, 105 | 6B76305523350D0300B7FE9B /* Sources */, 106 | 6B76305623350D0300B7FE9B /* Frameworks */, 107 | 6B76305723350D0300B7FE9B /* Resources */, 108 | 856D6333C955BB2D984276C1 /* [CP] Embed Pods Frameworks */, 109 | ); 110 | buildRules = ( 111 | ); 112 | dependencies = ( 113 | ); 114 | name = KRProgressHUDDemo; 115 | productName = KRProgressHUDDemo; 116 | productReference = 6B76305923350D0300B7FE9B /* KRProgressHUDDemo.app */; 117 | productType = "com.apple.product-type.application"; 118 | }; 119 | /* End PBXNativeTarget section */ 120 | 121 | /* Begin PBXProject section */ 122 | 6B76305123350D0300B7FE9B /* Project object */ = { 123 | isa = PBXProject; 124 | attributes = { 125 | LastSwiftUpdateCheck = 1100; 126 | LastUpgradeCheck = 1200; 127 | ORGANIZATIONNAME = Krimpedance; 128 | TargetAttributes = { 129 | 6B76305823350D0300B7FE9B = { 130 | CreatedOnToolsVersion = 11.0; 131 | }; 132 | }; 133 | }; 134 | buildConfigurationList = 6B76305423350D0300B7FE9B /* Build configuration list for PBXProject "KRProgressHUDDemo" */; 135 | compatibilityVersion = "Xcode 15.3"; 136 | developmentRegion = en; 137 | hasScannedForEncodings = 0; 138 | knownRegions = ( 139 | en, 140 | Base, 141 | ); 142 | mainGroup = 6B76305023350D0300B7FE9B; 143 | productRefGroup = 6B76305A23350D0300B7FE9B /* Products */; 144 | projectDirPath = ""; 145 | projectRoot = ""; 146 | targets = ( 147 | 6B76305823350D0300B7FE9B /* KRProgressHUDDemo */, 148 | ); 149 | }; 150 | /* End PBXProject section */ 151 | 152 | /* Begin PBXResourcesBuildPhase section */ 153 | 6B76305723350D0300B7FE9B /* Resources */ = { 154 | isa = PBXResourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | 6B76306923350D0500B7FE9B /* LaunchScreen.storyboard in Resources */, 158 | 6B76306623350D0500B7FE9B /* Assets.xcassets in Resources */, 159 | 6B76306423350D0300B7FE9B /* Main.storyboard in Resources */, 160 | 6B76307123350E8200B7FE9B /* image.png in Resources */, 161 | ); 162 | runOnlyForDeploymentPostprocessing = 0; 163 | }; 164 | /* End PBXResourcesBuildPhase section */ 165 | 166 | /* Begin PBXShellScriptBuildPhase section */ 167 | 856D6333C955BB2D984276C1 /* [CP] Embed Pods Frameworks */ = { 168 | isa = PBXShellScriptBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | ); 172 | inputFileListPaths = ( 173 | "${PODS_ROOT}/Target Support Files/Pods-KRProgressHUDDemo/Pods-KRProgressHUDDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist", 174 | ); 175 | name = "[CP] Embed Pods Frameworks"; 176 | outputFileListPaths = ( 177 | "${PODS_ROOT}/Target Support Files/Pods-KRProgressHUDDemo/Pods-KRProgressHUDDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist", 178 | ); 179 | runOnlyForDeploymentPostprocessing = 0; 180 | shellPath = /bin/sh; 181 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-KRProgressHUDDemo/Pods-KRProgressHUDDemo-frameworks.sh\"\n"; 182 | showEnvVarsInLog = 0; 183 | }; 184 | EA5DB11A0B3644984D84FC43 /* [CP] Check Pods Manifest.lock */ = { 185 | isa = PBXShellScriptBuildPhase; 186 | buildActionMask = 2147483647; 187 | files = ( 188 | ); 189 | inputFileListPaths = ( 190 | ); 191 | inputPaths = ( 192 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 193 | "${PODS_ROOT}/Manifest.lock", 194 | ); 195 | name = "[CP] Check Pods Manifest.lock"; 196 | outputFileListPaths = ( 197 | ); 198 | outputPaths = ( 199 | "$(DERIVED_FILE_DIR)/Pods-KRProgressHUDDemo-checkManifestLockResult.txt", 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | shellPath = /bin/sh; 203 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 204 | showEnvVarsInLog = 0; 205 | }; 206 | /* End PBXShellScriptBuildPhase section */ 207 | 208 | /* Begin PBXSourcesBuildPhase section */ 209 | 6B76305523350D0300B7FE9B /* Sources */ = { 210 | isa = PBXSourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | 6B76306123350D0300B7FE9B /* ViewController.swift in Sources */, 214 | 6B76305D23350D0300B7FE9B /* AppDelegate.swift in Sources */, 215 | 6B76305F23350D0300B7FE9B /* SceneDelegate.swift in Sources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | /* End PBXSourcesBuildPhase section */ 220 | 221 | /* Begin PBXVariantGroup section */ 222 | 6B76306223350D0300B7FE9B /* Main.storyboard */ = { 223 | isa = PBXVariantGroup; 224 | children = ( 225 | 6B76306323350D0300B7FE9B /* Base */, 226 | ); 227 | name = Main.storyboard; 228 | sourceTree = ""; 229 | }; 230 | 6B76306723350D0500B7FE9B /* LaunchScreen.storyboard */ = { 231 | isa = PBXVariantGroup; 232 | children = ( 233 | 6B76306823350D0500B7FE9B /* Base */, 234 | ); 235 | name = LaunchScreen.storyboard; 236 | sourceTree = ""; 237 | }; 238 | /* End PBXVariantGroup section */ 239 | 240 | /* Begin XCBuildConfiguration section */ 241 | 6B76306B23350D0500B7FE9B /* Debug */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ALWAYS_SEARCH_USER_PATHS = NO; 245 | CLANG_ANALYZER_NONNULL = YES; 246 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 247 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 248 | CLANG_CXX_LIBRARY = "libc++"; 249 | CLANG_ENABLE_MODULES = YES; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_ENABLE_OBJC_WEAK = YES; 252 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_COMMA = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INFINITE_RECURSION = YES; 262 | CLANG_WARN_INT_CONVERSION = YES; 263 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 264 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 265 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 267 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 268 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 269 | CLANG_WARN_STRICT_PROTOTYPES = YES; 270 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 271 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 272 | CLANG_WARN_UNREACHABLE_CODE = YES; 273 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 274 | COPY_PHASE_STRIP = NO; 275 | DEBUG_INFORMATION_FORMAT = dwarf; 276 | ENABLE_STRICT_OBJC_MSGSEND = YES; 277 | ENABLE_TESTABILITY = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu11; 279 | GCC_DYNAMIC_NO_PIC = NO; 280 | GCC_NO_COMMON_BLOCKS = YES; 281 | GCC_OPTIMIZATION_LEVEL = 0; 282 | GCC_PREPROCESSOR_DEFINITIONS = ( 283 | "DEBUG=1", 284 | "$(inherited)", 285 | ); 286 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 287 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 288 | GCC_WARN_UNDECLARED_SELECTOR = YES; 289 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 290 | GCC_WARN_UNUSED_FUNCTION = YES; 291 | GCC_WARN_UNUSED_VARIABLE = YES; 292 | IPHONEOS_DEPLOYMENT_TARGET = 13.6; 293 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 294 | MTL_FAST_MATH = YES; 295 | SDKROOT = iphoneos; 296 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 297 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 298 | }; 299 | name = Debug; 300 | }; 301 | 6B76306C23350D0500B7FE9B /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ALWAYS_SEARCH_USER_PATHS = NO; 305 | CLANG_ANALYZER_NONNULL = YES; 306 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_ENABLE_OBJC_WEAK = YES; 312 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_COMMA = YES; 315 | CLANG_WARN_CONSTANT_CONVERSION = YES; 316 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 319 | CLANG_WARN_EMPTY_BODY = YES; 320 | CLANG_WARN_ENUM_CONVERSION = YES; 321 | CLANG_WARN_INFINITE_RECURSION = YES; 322 | CLANG_WARN_INT_CONVERSION = YES; 323 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 325 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 326 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 327 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 328 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 329 | CLANG_WARN_STRICT_PROTOTYPES = YES; 330 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 331 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 332 | CLANG_WARN_UNREACHABLE_CODE = YES; 333 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 334 | COPY_PHASE_STRIP = NO; 335 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 336 | ENABLE_NS_ASSERTIONS = NO; 337 | ENABLE_STRICT_OBJC_MSGSEND = YES; 338 | GCC_C_LANGUAGE_STANDARD = gnu11; 339 | GCC_NO_COMMON_BLOCKS = YES; 340 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 341 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 342 | GCC_WARN_UNDECLARED_SELECTOR = YES; 343 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 344 | GCC_WARN_UNUSED_FUNCTION = YES; 345 | GCC_WARN_UNUSED_VARIABLE = YES; 346 | IPHONEOS_DEPLOYMENT_TARGET = 13.6; 347 | MTL_ENABLE_DEBUG_INFO = NO; 348 | MTL_FAST_MATH = YES; 349 | SDKROOT = iphoneos; 350 | SWIFT_COMPILATION_MODE = wholemodule; 351 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 352 | VALIDATE_PRODUCT = YES; 353 | }; 354 | name = Release; 355 | }; 356 | 6B76306E23350D0500B7FE9B /* Debug */ = { 357 | isa = XCBuildConfiguration; 358 | baseConfigurationReference = 994DC6EFFEA4B215AAD5F34F /* Pods-KRProgressHUDDemo.debug.xcconfig */; 359 | buildSettings = { 360 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 361 | CURRENT_PROJECT_VERSION = 3.4.7; 362 | DEVELOPMENT_TEAM = ""; 363 | INFOPLIST_FILE = KRProgressHUDDemo/Info.plist; 364 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 365 | LD_RUNPATH_SEARCH_PATHS = ( 366 | "$(inherited)", 367 | "@executable_path/Frameworks", 368 | ); 369 | MARKETING_VERSION = 3.4.7; 370 | ONLY_ACTIVE_ARCH = YES; 371 | PRODUCT_BUNDLE_IDENTIFIER = com.krimpedance.KRProgressHUDDemo; 372 | PRODUCT_NAME = "$(TARGET_NAME)"; 373 | SWIFT_VERSION = 5.0; 374 | TARGETED_DEVICE_FAMILY = "1,2"; 375 | }; 376 | name = Debug; 377 | }; 378 | 6B76306F23350D0500B7FE9B /* Release */ = { 379 | isa = XCBuildConfiguration; 380 | baseConfigurationReference = 9DF5449C0CD963C59EE7D6BE /* Pods-KRProgressHUDDemo.release.xcconfig */; 381 | buildSettings = { 382 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 383 | CURRENT_PROJECT_VERSION = 3.4.7; 384 | DEVELOPMENT_TEAM = ""; 385 | INFOPLIST_FILE = KRProgressHUDDemo/Info.plist; 386 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 387 | LD_RUNPATH_SEARCH_PATHS = ( 388 | "$(inherited)", 389 | "@executable_path/Frameworks", 390 | ); 391 | MARKETING_VERSION = 3.4.7; 392 | PRODUCT_BUNDLE_IDENTIFIER = com.krimpedance.KRProgressHUDDemo; 393 | PRODUCT_NAME = "$(TARGET_NAME)"; 394 | SWIFT_VERSION = 5.0; 395 | TARGETED_DEVICE_FAMILY = "1,2"; 396 | }; 397 | name = Release; 398 | }; 399 | /* End XCBuildConfiguration section */ 400 | 401 | /* Begin XCConfigurationList section */ 402 | 6B76305423350D0300B7FE9B /* Build configuration list for PBXProject "KRProgressHUDDemo" */ = { 403 | isa = XCConfigurationList; 404 | buildConfigurations = ( 405 | 6B76306B23350D0500B7FE9B /* Debug */, 406 | 6B76306C23350D0500B7FE9B /* Release */, 407 | ); 408 | defaultConfigurationIsVisible = 0; 409 | defaultConfigurationName = Release; 410 | }; 411 | 6B76306D23350D0500B7FE9B /* Build configuration list for PBXNativeTarget "KRProgressHUDDemo" */ = { 412 | isa = XCConfigurationList; 413 | buildConfigurations = ( 414 | 6B76306E23350D0500B7FE9B /* Debug */, 415 | 6B76306F23350D0500B7FE9B /* Release */, 416 | ); 417 | defaultConfigurationIsVisible = 0; 418 | defaultConfigurationName = Release; 419 | }; 420 | /* End XCConfigurationList section */ 421 | }; 422 | rootObject = 6B76305123350D0300B7FE9B /* Project object */; 423 | } 424 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // KRProgressHUDDemo 4 | // 5 | // Created by Krimpedance on 2019/09/20. 6 | // Copyright © 2019 Krimpedance. 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, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | @available(iOS 13.0, *) 24 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 25 | // Called when a new scene session is being created. 26 | // Use this method to select a configuration to create the new scene with. 27 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 28 | } 29 | 30 | @available(iOS 13.0, *) 31 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 32 | // Called when the user discards a scene session. 33 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 34 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/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 | 35 | 45 | 55 | 65 | 75 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 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 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 162 | 171 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 223 | 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 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationLandscapeLeft 53 | UIInterfaceOrientationLandscapeRight 54 | UIInterfaceOrientationPortrait 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationPortraitUpsideDown 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // KRProgressHUDDemo 4 | // 5 | // Copyright © 2019 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | @available(iOS 13.0, *) 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 16 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 17 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 18 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 19 | guard let _ = (scene as? UIWindowScene) else { return } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // KRProgressHUDDemo 4 | // 5 | // Copyright © 2019 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | import KRProgressHUD 10 | import KRActivityIndicatorView 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet weak var messageControl: UISegmentedControl! 15 | @IBOutlet weak var headColorLabel: UILabel! 16 | @IBOutlet weak var headColorControl: UISegmentedControl! 17 | @IBOutlet weak var tailColorLabel: UILabel! 18 | @IBOutlet weak var tailColorControl: UISegmentedControl! 19 | 20 | let colors: [UIColor] = [.red, .green, .blue, .orange, .yellow] 21 | 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | switchColorPartsHidden(true) 25 | } 26 | 27 | func switchColorPartsHidden(_ hidden: Bool) { 28 | headColorLabel.isHidden = hidden 29 | headColorControl.isHidden = hidden 30 | tailColorLabel.isHidden = hidden 31 | tailColorControl.isHidden = hidden 32 | } 33 | } 34 | 35 | // MARK: - Button action --------------- 36 | 37 | extension ViewController { 38 | @IBAction func showButtonTapped(withSender sender: UIButton) { 39 | if messageControl.selectedSegmentIndex == 0 { 40 | KRProgressHUD.show { 41 | print("show() completion handler.") 42 | } 43 | } else { 44 | KRProgressHUD.show(withMessage: "Loading...") 45 | } 46 | 47 | let delay = DispatchTime.now() + 2 48 | DispatchQueue.main.asyncAfter(deadline: delay) { 49 | KRProgressHUD.dismiss { 50 | print("dismiss() completion handler.") 51 | } 52 | } 53 | } 54 | 55 | @IBAction func showTextButtonTapped(withSender sender: UIButton) { 56 | let rand = arc4random() % 10 57 | if rand > 2 { 58 | KRProgressHUD.showMessage("message only HUD :)\nThis can indicate multiline message.") 59 | } else { 60 | KRProgressHUD.showMessage("こ\nん\nに\nち\nは\n😃") 61 | } 62 | } 63 | 64 | @IBAction func showSuccessButtonTapped(withSender sender: UIButton) { 65 | KRProgressHUD.showSuccess(withMessage: messageControl.selectedSegmentIndex == 0 ? nil : "Success!") 66 | } 67 | 68 | @IBAction func showInfoButtonTapped(withSender sender: UIButton) { 69 | KRProgressHUD.showInfo(withMessage: messageControl.selectedSegmentIndex == 0 ? nil : "Info") 70 | } 71 | 72 | @IBAction func showWarningButtonTapped(withSender sender: UIButton) { 73 | KRProgressHUD.showWarning(withMessage: messageControl.selectedSegmentIndex == 0 ? nil : "Warning!") 74 | } 75 | 76 | @IBAction func showErrorButtonTapped(withSender sender: UIButton) { 77 | KRProgressHUD.showError(withMessage: messageControl.selectedSegmentIndex == 0 ? nil : "Error...") 78 | } 79 | 80 | @IBAction func showWithImageButtonTapped(withSender sender: UIButton) { 81 | let image = UIImage(named: "image.png")! 82 | KRProgressHUD.showImage(image, message: messageControl.selectedSegmentIndex == 0 ? nil : "Custom image") 83 | } 84 | } 85 | 86 | // MARK: - UISegmentedControl value change actions --------------- 87 | 88 | extension ViewController { 89 | @IBAction func changedMaskTypeControlValue(withSender sender: UISegmentedControl) { 90 | let maskTypes: [KRProgressHUDMaskType] = [.black, .white, .clear] 91 | KRProgressHUD.set(maskType: maskTypes[sender.selectedSegmentIndex]) 92 | } 93 | 94 | @IBAction func changedProgressHUDStyleControlValue(withSender sender: UISegmentedControl) { 95 | let styles: [KRProgressHUDStyle] = [.white, .black, .custom(background: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1), text: #colorLiteral(red: 0.1294117719, green: 0.2156862766, blue: 0.06666667014, alpha: 1), icon: #colorLiteral(red: 0.1294117719, green: 0.2156862766, blue: 0.06666667014, alpha: 1))] 96 | KRProgressHUD.set(style: styles[sender.selectedSegmentIndex]) 97 | } 98 | 99 | @IBAction func changedActivityIndicatorStyleControlValue(withSender sender: UISegmentedControl) { 100 | let headColor = colors[headColorControl.selectedSegmentIndex] 101 | let tailColor = colors[tailColorControl.selectedSegmentIndex] 102 | let colorsList: [[UIColor]] = [ 103 | [.black, .lightGray], 104 | [.white, UIColor(white: 0.7, alpha: 1)], 105 | [headColor, tailColor] 106 | ] 107 | KRProgressHUD.set(activityIndicatorViewColors: colorsList[sender.selectedSegmentIndex]) 108 | switchColorPartsHidden(sender.selectedSegmentIndex != 2) 109 | } 110 | 111 | @IBAction func changedHeadColorControlValue(withSender sender: UISegmentedControl) { 112 | let headColor = colors[headColorControl.selectedSegmentIndex] 113 | let tailColor = colors[tailColorControl.selectedSegmentIndex] 114 | KRProgressHUD.set(activityIndicatorViewColors: [headColor, tailColor]) 115 | } 116 | 117 | @IBAction func changedTailColorControlValue(withSender sender: UISegmentedControl) { 118 | let headColor = colors[headColorControl.selectedSegmentIndex] 119 | let tailColor = colors[tailColorControl.selectedSegmentIndex] 120 | KRProgressHUD.set(activityIndicatorViewColors: [headColor, tailColor]) 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /DEMO/KRProgressHUDDemo/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krimpedance/KRProgressHUD/2d6b0246682fce2c8e226235c9cd6065d0b95e00/DEMO/KRProgressHUDDemo/image.png -------------------------------------------------------------------------------- /DEMO/Podfile: -------------------------------------------------------------------------------- 1 | # Podfile 2 | platform :ios, '12.0' 3 | 4 | target 'KRProgressHUDDemo' do 5 | use_frameworks! 6 | pod 'KRProgressHUD', path: '../KRProgressHUD.podspec' 7 | end 8 | -------------------------------------------------------------------------------- /DEMO/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - KRActivityIndicatorView (3.0.8) 3 | - KRProgressHUD (3.4.8): 4 | - KRActivityIndicatorView (= 3.0.8) 5 | 6 | DEPENDENCIES: 7 | - KRProgressHUD (from `../KRProgressHUD.podspec`) 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - KRActivityIndicatorView 12 | 13 | EXTERNAL SOURCES: 14 | KRProgressHUD: 15 | :path: "../KRProgressHUD.podspec" 16 | 17 | SPEC CHECKSUMS: 18 | KRActivityIndicatorView: c5c503bf56e54834382dd926b64ff47287ca0006 19 | KRProgressHUD: d0fb4e72428d312eb6966e84c543ea58fb1efbc7 20 | 21 | PODFILE CHECKSUM: aff884d841c3ed80e8dec4e8df5cfe54b77cde57 22 | 23 | COCOAPODS: 1.15.2 24 | -------------------------------------------------------------------------------- /KRProgressHUD.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "KRProgressHUD" 3 | s.version = "3.4.8" 4 | s.summary = "A beautiful progress HUD for your iOS." 5 | s.description = "KRProgressHUD is a beautiful and easy-to-use HUD meant to display the progress on iOS." 6 | s.homepage = "https://github.com/krimpedance/KRProgressHUD" 7 | s.license = { :type => "MIT", :file => "LICENSE" } 8 | 9 | s.author = { "krimpedance" => "info@krimpedance.com" } 10 | s.requires_arc = true 11 | s.platform = :ios, '12.0' 12 | s.ios.deployment_target = '12.0' 13 | s.swift_version = '5.3' 14 | 15 | s.source = { :git => "https://github.com/krimpedance/KRProgressHUD.git", :tag => s.version.to_s } 16 | s.source_files = "KRProgressHUD/**/*.swift" 17 | 18 | s.dependency "KRActivityIndicatorView", "3.0.8" 19 | end 20 | -------------------------------------------------------------------------------- /KRProgressHUD.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 63; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B5D62AF1D8411730027D21E /* KRProgressHUD.swift in Headers */ = {isa = PBXBuildFile; fileRef = 4BA70C3F1D02F2ED009EB743 /* KRProgressHUD.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 4B7576D61D1BC6AB003FF258 /* InnerKRProgressHUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7576D51D1BC6AB003FF258 /* InnerKRProgressHUD.swift */; }; 12 | 4B7576D81D1BC838003FF258 /* KRProgressHUDViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7576D71D1BC838003FF258 /* KRProgressHUDViewController.swift */; }; 13 | 4B7576E21D1BCD56003FF258 /* KRProgressHUD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BA70C301D02F28D009EB743 /* KRProgressHUD.framework */; }; 14 | 4B7576EC1D1BECE8003FF258 /* KRProgressHUDTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B7576DF1D1BCD56003FF258 /* KRProgressHUDTests.swift */; }; 15 | 4BA70C341D02F28D009EB743 /* KRProgressHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BA70C331D02F28D009EB743 /* KRProgressHUD.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | 4BA70C431D02F2ED009EB743 /* KRProgressHUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA70C3F1D02F2ED009EB743 /* KRProgressHUD.swift */; }; 17 | 4BA70C441D02F2ED009EB743 /* KRProgressHUDIconType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA70C401D02F2ED009EB743 /* KRProgressHUDIconType.swift */; }; 18 | 6B0119002B9AD72E00BC66E6 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 6B0118FF2B9AD72E00BC66E6 /* PrivacyInfo.xcprivacy */; }; 19 | 6B08733C2165B5870056A74B /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B08733A2165B5870056A74B /* Quick.framework */; }; 20 | 6B08733D2165B5870056A74B /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B08733B2165B5870056A74B /* Nimble.framework */; }; 21 | 6B08733F2165B5960056A74B /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6B08733B2165B5870056A74B /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 22 | 6B0873402165B5960056A74B /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6B08733A2165B5870056A74B /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 23 | 6B67E60C1FF4E1AC009699A8 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B67E60B1FF4E1AC009699A8 /* Extensions.swift */; }; 24 | 6B8AE6981ECE793600CE27A8 /* KRActivityIndicatorView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6BD5F7C71EC3F3E4007A502E /* KRActivityIndicatorView.framework */; }; 25 | 6BD5F7C81EC3F3E4007A502E /* KRActivityIndicatorView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6BD5F7C71EC3F3E4007A502E /* KRActivityIndicatorView.framework */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 4B7576E31D1BCD56003FF258 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 4BA70C271D02F28D009EB743 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 4BA70C2F1D02F28D009EB743; 34 | remoteInfo = KRProgressHUD; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXCopyFilesBuildPhase section */ 39 | 6B08733E2165B58A0056A74B /* CopyFiles */ = { 40 | isa = PBXCopyFilesBuildPhase; 41 | buildActionMask = 2147483647; 42 | dstPath = ""; 43 | dstSubfolderSpec = 10; 44 | files = ( 45 | 6B08733F2165B5960056A74B /* Nimble.framework in CopyFiles */, 46 | 6B0873402165B5960056A74B /* Quick.framework in CopyFiles */, 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | /* End PBXCopyFilesBuildPhase section */ 51 | 52 | /* Begin PBXFileReference section */ 53 | 4B7576D51D1BC6AB003FF258 /* InnerKRProgressHUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InnerKRProgressHUD.swift; sourceTree = ""; }; 54 | 4B7576D71D1BC838003FF258 /* KRProgressHUDViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRProgressHUDViewController.swift; sourceTree = ""; }; 55 | 4B7576DD1D1BCD56003FF258 /* KRProgressHUDTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KRProgressHUDTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 4B7576DF1D1BCD56003FF258 /* KRProgressHUDTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KRProgressHUDTests.swift; sourceTree = ""; }; 57 | 4B7576E11D1BCD56003FF258 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | 4BA70C301D02F28D009EB743 /* KRProgressHUD.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KRProgressHUD.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 4BA70C331D02F28D009EB743 /* KRProgressHUD.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KRProgressHUD.h; sourceTree = ""; }; 60 | 4BA70C351D02F28D009EB743 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 61 | 4BA70C3F1D02F2ED009EB743 /* KRProgressHUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRProgressHUD.swift; sourceTree = ""; }; 62 | 4BA70C401D02F2ED009EB743 /* KRProgressHUDIconType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KRProgressHUDIconType.swift; sourceTree = ""; }; 63 | 6B0118FF2B9AD72E00BC66E6 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 64 | 6B08733A2165B5870056A74B /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/iOS/Quick.framework; sourceTree = ""; }; 65 | 6B08733B2165B5870056A74B /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = ""; }; 66 | 6B67E60B1FF4E1AC009699A8 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; 67 | 6BD5F7C71EC3F3E4007A502E /* KRActivityIndicatorView.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KRActivityIndicatorView.framework; path = Carthage/Build/iOS/KRActivityIndicatorView.framework; sourceTree = ""; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | 4B7576DA1D1BCD56003FF258 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | 6B08733C2165B5870056A74B /* Quick.framework in Frameworks */, 76 | 6B08733D2165B5870056A74B /* Nimble.framework in Frameworks */, 77 | 6B8AE6981ECE793600CE27A8 /* KRActivityIndicatorView.framework in Frameworks */, 78 | 4B7576E21D1BCD56003FF258 /* KRProgressHUD.framework in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | 4BA70C2C1D02F28D009EB743 /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | 6BD5F7C81EC3F3E4007A502E /* KRActivityIndicatorView.framework in Frameworks */, 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | /* End PBXFrameworksBuildPhase section */ 91 | 92 | /* Begin PBXGroup section */ 93 | 4B7576DE1D1BCD56003FF258 /* KRProgressHUDTests */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 4B7576DF1D1BCD56003FF258 /* KRProgressHUDTests.swift */, 97 | 4B7576E11D1BCD56003FF258 /* Info.plist */, 98 | ); 99 | path = KRProgressHUDTests; 100 | sourceTree = ""; 101 | }; 102 | 4BA70C261D02F28D009EB743 = { 103 | isa = PBXGroup; 104 | children = ( 105 | 4BA70C321D02F28D009EB743 /* KRProgressHUD */, 106 | 4B7576DE1D1BCD56003FF258 /* KRProgressHUDTests */, 107 | 4BA70C311D02F28D009EB743 /* Products */, 108 | 6BD5F7C61EC3F3E4007A502E /* Frameworks */, 109 | ); 110 | sourceTree = ""; 111 | }; 112 | 4BA70C311D02F28D009EB743 /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 4BA70C301D02F28D009EB743 /* KRProgressHUD.framework */, 116 | 4B7576DD1D1BCD56003FF258 /* KRProgressHUDTests.xctest */, 117 | ); 118 | name = Products; 119 | sourceTree = ""; 120 | }; 121 | 4BA70C321D02F28D009EB743 /* KRProgressHUD */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 4BA70C3B1D02F2ED009EB743 /* Classes */, 125 | 4BA70C331D02F28D009EB743 /* KRProgressHUD.h */, 126 | 4BA70C351D02F28D009EB743 /* Info.plist */, 127 | 6B0118FF2B9AD72E00BC66E6 /* PrivacyInfo.xcprivacy */, 128 | ); 129 | path = KRProgressHUD; 130 | sourceTree = ""; 131 | }; 132 | 4BA70C3B1D02F2ED009EB743 /* Classes */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 4BA70C3F1D02F2ED009EB743 /* KRProgressHUD.swift */, 136 | 4B7576D51D1BC6AB003FF258 /* InnerKRProgressHUD.swift */, 137 | 4BA70C401D02F2ED009EB743 /* KRProgressHUDIconType.swift */, 138 | 4B7576D71D1BC838003FF258 /* KRProgressHUDViewController.swift */, 139 | 6B67E60B1FF4E1AC009699A8 /* Extensions.swift */, 140 | ); 141 | path = Classes; 142 | sourceTree = ""; 143 | }; 144 | 6BD5F7C61EC3F3E4007A502E /* Frameworks */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 6B08733B2165B5870056A74B /* Nimble.framework */, 148 | 6B08733A2165B5870056A74B /* Quick.framework */, 149 | 6BD5F7C71EC3F3E4007A502E /* KRActivityIndicatorView.framework */, 150 | ); 151 | name = Frameworks; 152 | sourceTree = ""; 153 | }; 154 | /* End PBXGroup section */ 155 | 156 | /* Begin PBXHeadersBuildPhase section */ 157 | 4BA70C2D1D02F28D009EB743 /* Headers */ = { 158 | isa = PBXHeadersBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | 4BA70C341D02F28D009EB743 /* KRProgressHUD.h in Headers */, 162 | 4B5D62AF1D8411730027D21E /* KRProgressHUD.swift in Headers */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXHeadersBuildPhase section */ 167 | 168 | /* Begin PBXNativeTarget section */ 169 | 4B7576DC1D1BCD56003FF258 /* KRProgressHUDTests */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 4B7576E51D1BCD56003FF258 /* Build configuration list for PBXNativeTarget "KRProgressHUDTests" */; 172 | buildPhases = ( 173 | 4B7576D91D1BCD56003FF258 /* Sources */, 174 | 4B7576DA1D1BCD56003FF258 /* Frameworks */, 175 | 4B7576DB1D1BCD56003FF258 /* Resources */, 176 | 6B08733E2165B58A0056A74B /* CopyFiles */, 177 | ); 178 | buildRules = ( 179 | ); 180 | dependencies = ( 181 | 4B7576E41D1BCD56003FF258 /* PBXTargetDependency */, 182 | ); 183 | name = KRProgressHUDTests; 184 | productName = KRProgressHUDTests; 185 | productReference = 4B7576DD1D1BCD56003FF258 /* KRProgressHUDTests.xctest */; 186 | productType = "com.apple.product-type.bundle.unit-test"; 187 | }; 188 | 4BA70C2F1D02F28D009EB743 /* KRProgressHUD */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = 4BA70C381D02F28D009EB743 /* Build configuration list for PBXNativeTarget "KRProgressHUD" */; 191 | buildPhases = ( 192 | 4BA70C2B1D02F28D009EB743 /* Sources */, 193 | 4BA70C2C1D02F28D009EB743 /* Frameworks */, 194 | 4BA70C2D1D02F28D009EB743 /* Headers */, 195 | 4BA70C2E1D02F28D009EB743 /* Resources */, 196 | 4BDC01FF1D3894F8004A5663 /* Swift Lint */, 197 | ); 198 | buildRules = ( 199 | ); 200 | dependencies = ( 201 | ); 202 | name = KRProgressHUD; 203 | productName = KRProgressHUD; 204 | productReference = 4BA70C301D02F28D009EB743 /* KRProgressHUD.framework */; 205 | productType = "com.apple.product-type.framework"; 206 | }; 207 | /* End PBXNativeTarget section */ 208 | 209 | /* Begin PBXProject section */ 210 | 4BA70C271D02F28D009EB743 /* Project object */ = { 211 | isa = PBXProject; 212 | attributes = { 213 | BuildIndependentTargetsInParallel = YES; 214 | LastSwiftUpdateCheck = 0730; 215 | LastUpgradeCheck = 1530; 216 | ORGANIZATIONNAME = Krimpedance; 217 | TargetAttributes = { 218 | 4B7576DC1D1BCD56003FF258 = { 219 | CreatedOnToolsVersion = 7.3.1; 220 | LastSwiftMigration = 0800; 221 | }; 222 | 4BA70C2F1D02F28D009EB743 = { 223 | CreatedOnToolsVersion = 7.3.1; 224 | LastSwiftMigration = 0800; 225 | ProvisioningStyle = Automatic; 226 | }; 227 | }; 228 | }; 229 | buildConfigurationList = 4BA70C2A1D02F28D009EB743 /* Build configuration list for PBXProject "KRProgressHUD" */; 230 | compatibilityVersion = "Xcode 15.3"; 231 | developmentRegion = en; 232 | hasScannedForEncodings = 0; 233 | knownRegions = ( 234 | en, 235 | Base, 236 | ); 237 | mainGroup = 4BA70C261D02F28D009EB743; 238 | productRefGroup = 4BA70C311D02F28D009EB743 /* Products */; 239 | projectDirPath = ""; 240 | projectRoot = ""; 241 | targets = ( 242 | 4BA70C2F1D02F28D009EB743 /* KRProgressHUD */, 243 | 4B7576DC1D1BCD56003FF258 /* KRProgressHUDTests */, 244 | ); 245 | }; 246 | /* End PBXProject section */ 247 | 248 | /* Begin PBXResourcesBuildPhase section */ 249 | 4B7576DB1D1BCD56003FF258 /* Resources */ = { 250 | isa = PBXResourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | 4BA70C2E1D02F28D009EB743 /* Resources */ = { 257 | isa = PBXResourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 6B0119002B9AD72E00BC66E6 /* PrivacyInfo.xcprivacy in Resources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXResourcesBuildPhase section */ 265 | 266 | /* Begin PBXShellScriptBuildPhase section */ 267 | 4BDC01FF1D3894F8004A5663 /* Swift Lint */ = { 268 | isa = PBXShellScriptBuildPhase; 269 | alwaysOutOfDate = 1; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | ); 273 | inputPaths = ( 274 | ); 275 | name = "Swift Lint"; 276 | outputPaths = ( 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | shellPath = /bin/sh; 280 | shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"SwiftLint does not exist, download from https://github.com/realm/SwiftLint\"\nfi\n"; 281 | }; 282 | /* End PBXShellScriptBuildPhase section */ 283 | 284 | /* Begin PBXSourcesBuildPhase section */ 285 | 4B7576D91D1BCD56003FF258 /* Sources */ = { 286 | isa = PBXSourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | 4B7576EC1D1BECE8003FF258 /* KRProgressHUDTests.swift in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 4BA70C2B1D02F28D009EB743 /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 6B67E60C1FF4E1AC009699A8 /* Extensions.swift in Sources */, 298 | 4BA70C441D02F2ED009EB743 /* KRProgressHUDIconType.swift in Sources */, 299 | 4B7576D61D1BC6AB003FF258 /* InnerKRProgressHUD.swift in Sources */, 300 | 4B7576D81D1BC838003FF258 /* KRProgressHUDViewController.swift in Sources */, 301 | 4BA70C431D02F2ED009EB743 /* KRProgressHUD.swift in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | /* End PBXSourcesBuildPhase section */ 306 | 307 | /* Begin PBXTargetDependency section */ 308 | 4B7576E41D1BCD56003FF258 /* PBXTargetDependency */ = { 309 | isa = PBXTargetDependency; 310 | target = 4BA70C2F1D02F28D009EB743 /* KRProgressHUD */; 311 | targetProxy = 4B7576E31D1BCD56003FF258 /* PBXContainerItemProxy */; 312 | }; 313 | /* End PBXTargetDependency section */ 314 | 315 | /* Begin XCBuildConfiguration section */ 316 | 4B7576E61D1BCD56003FF258 /* Debug */ = { 317 | isa = XCBuildConfiguration; 318 | buildSettings = { 319 | BUNDLE_LOADER = ""; 320 | FRAMEWORK_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Carthage/Build/iOS", 323 | ); 324 | INFOPLIST_FILE = KRProgressHUDTests/Info.plist; 325 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 326 | LD_RUNPATH_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "@executable_path/Frameworks", 329 | "@loader_path/Frameworks", 330 | "$(PROJECT_DIR)/Carthage/Build/iOS", 331 | ); 332 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRProgressHUDTests; 333 | PRODUCT_NAME = "$(TARGET_NAME)"; 334 | SWIFT_VERSION = 5.0; 335 | TEST_HOST = ""; 336 | }; 337 | name = Debug; 338 | }; 339 | 4B7576E71D1BCD56003FF258 /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | BUNDLE_LOADER = ""; 343 | FRAMEWORK_SEARCH_PATHS = ( 344 | "$(inherited)", 345 | "$(PROJECT_DIR)/Carthage/Build/iOS", 346 | ); 347 | INFOPLIST_FILE = KRProgressHUDTests/Info.plist; 348 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 349 | LD_RUNPATH_SEARCH_PATHS = ( 350 | "$(inherited)", 351 | "@executable_path/Frameworks", 352 | "@loader_path/Frameworks", 353 | "$(PROJECT_DIR)/Carthage/Build/iOS", 354 | ); 355 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRProgressHUDTests; 356 | PRODUCT_NAME = "$(TARGET_NAME)"; 357 | SWIFT_VERSION = 5.0; 358 | TEST_HOST = ""; 359 | }; 360 | name = Release; 361 | }; 362 | 4BA70C361D02F28D009EB743 /* Debug */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ALWAYS_SEARCH_USER_PATHS = NO; 366 | CLANG_ANALYZER_NONNULL = YES; 367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 368 | CLANG_CXX_LIBRARY = "libc++"; 369 | CLANG_ENABLE_MODULES = YES; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 372 | CLANG_WARN_BOOL_CONVERSION = YES; 373 | CLANG_WARN_COMMA = YES; 374 | CLANG_WARN_CONSTANT_CONVERSION = YES; 375 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 376 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INFINITE_RECURSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 383 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 386 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 387 | CLANG_WARN_STRICT_PROTOTYPES = YES; 388 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 389 | CLANG_WARN_UNREACHABLE_CODE = YES; 390 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 391 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 392 | COPY_PHASE_STRIP = NO; 393 | CURRENT_PROJECT_VERSION = 1; 394 | DEBUG_INFORMATION_FORMAT = dwarf; 395 | ENABLE_STRICT_OBJC_MSGSEND = YES; 396 | ENABLE_TESTABILITY = YES; 397 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 398 | GCC_C_LANGUAGE_STANDARD = gnu99; 399 | GCC_DYNAMIC_NO_PIC = NO; 400 | GCC_NO_COMMON_BLOCKS = YES; 401 | GCC_OPTIMIZATION_LEVEL = 0; 402 | GCC_PREPROCESSOR_DEFINITIONS = ( 403 | "DEBUG=1", 404 | "$(inherited)", 405 | ); 406 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 407 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 408 | GCC_WARN_UNDECLARED_SELECTOR = YES; 409 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 410 | GCC_WARN_UNUSED_FUNCTION = YES; 411 | GCC_WARN_UNUSED_VARIABLE = YES; 412 | IPHONEOS_DEPLOYMENT_TARGET = 17.0; 413 | MTL_ENABLE_DEBUG_INFO = YES; 414 | ONLY_ACTIVE_ARCH = YES; 415 | SDKROOT = iphoneos; 416 | SWIFT_COMPILATION_MODE = singlefile; 417 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 418 | SWIFT_VERSION = 5.0; 419 | TARGETED_DEVICE_FAMILY = "1,2"; 420 | VERSIONING_SYSTEM = "apple-generic"; 421 | VERSION_INFO_PREFIX = ""; 422 | }; 423 | name = Debug; 424 | }; 425 | 4BA70C371D02F28D009EB743 /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_SEARCH_USER_PATHS = NO; 429 | CLANG_ANALYZER_NONNULL = YES; 430 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 431 | CLANG_CXX_LIBRARY = "libc++"; 432 | CLANG_ENABLE_MODULES = YES; 433 | CLANG_ENABLE_OBJC_ARC = YES; 434 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 435 | CLANG_WARN_BOOL_CONVERSION = YES; 436 | CLANG_WARN_COMMA = YES; 437 | CLANG_WARN_CONSTANT_CONVERSION = YES; 438 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 439 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 440 | CLANG_WARN_EMPTY_BODY = YES; 441 | CLANG_WARN_ENUM_CONVERSION = YES; 442 | CLANG_WARN_INFINITE_RECURSION = YES; 443 | CLANG_WARN_INT_CONVERSION = YES; 444 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 445 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 446 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 447 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 448 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 449 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 450 | CLANG_WARN_STRICT_PROTOTYPES = YES; 451 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 452 | CLANG_WARN_UNREACHABLE_CODE = YES; 453 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 454 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 455 | COPY_PHASE_STRIP = NO; 456 | CURRENT_PROJECT_VERSION = 1; 457 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 458 | ENABLE_NS_ASSERTIONS = NO; 459 | ENABLE_STRICT_OBJC_MSGSEND = YES; 460 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 461 | GCC_C_LANGUAGE_STANDARD = gnu99; 462 | GCC_NO_COMMON_BLOCKS = YES; 463 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 464 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 465 | GCC_WARN_UNDECLARED_SELECTOR = YES; 466 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 467 | GCC_WARN_UNUSED_FUNCTION = YES; 468 | GCC_WARN_UNUSED_VARIABLE = YES; 469 | IPHONEOS_DEPLOYMENT_TARGET = 17.0; 470 | MTL_ENABLE_DEBUG_INFO = NO; 471 | SDKROOT = iphoneos; 472 | SWIFT_COMPILATION_MODE = wholemodule; 473 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 474 | SWIFT_VERSION = 5.0; 475 | TARGETED_DEVICE_FAMILY = "1,2"; 476 | VALIDATE_PRODUCT = YES; 477 | VERSIONING_SYSTEM = "apple-generic"; 478 | VERSION_INFO_PREFIX = ""; 479 | }; 480 | name = Release; 481 | }; 482 | 4BA70C391D02F28D009EB743 /* Debug */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | APPLICATION_EXTENSION_API_ONLY = NO; 486 | CODE_SIGN_STYLE = Automatic; 487 | CURRENT_PROJECT_VERSION = 3.4.7; 488 | DEFINES_MODULE = YES; 489 | DEVELOPMENT_TEAM = ""; 490 | DYLIB_COMPATIBILITY_VERSION = 1; 491 | DYLIB_CURRENT_VERSION = 1; 492 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 493 | ENABLE_MODULE_VERIFIER = YES; 494 | FRAMEWORK_SEARCH_PATHS = ( 495 | "$(inherited)", 496 | "$(PROJECT_DIR)/Carthage/Build/iOS", 497 | ); 498 | INFOPLIST_FILE = KRProgressHUD/Info.plist; 499 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 500 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 501 | "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1; 502 | LD_RUNPATH_SEARCH_PATHS = ( 503 | "$(inherited)", 504 | "@executable_path/Frameworks", 505 | "@loader_path/Frameworks", 506 | ); 507 | MARKETING_VERSION = 3.4.7; 508 | MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; 509 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRProgressHUD; 510 | PRODUCT_NAME = "$(TARGET_NAME)"; 511 | PROVISIONING_PROFILE_SPECIFIER = ""; 512 | SKIP_INSTALL = YES; 513 | }; 514 | name = Debug; 515 | }; 516 | 4BA70C3A1D02F28D009EB743 /* Release */ = { 517 | isa = XCBuildConfiguration; 518 | buildSettings = { 519 | APPLICATION_EXTENSION_API_ONLY = NO; 520 | CODE_SIGN_STYLE = Automatic; 521 | CURRENT_PROJECT_VERSION = 3.4.7; 522 | DEFINES_MODULE = YES; 523 | DEVELOPMENT_TEAM = ""; 524 | DYLIB_COMPATIBILITY_VERSION = 1; 525 | DYLIB_CURRENT_VERSION = 1; 526 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 527 | ENABLE_MODULE_VERIFIER = YES; 528 | FRAMEWORK_SEARCH_PATHS = ( 529 | "$(inherited)", 530 | "$(PROJECT_DIR)/Carthage/Build/iOS", 531 | ); 532 | INFOPLIST_FILE = KRProgressHUD/Info.plist; 533 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 534 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 535 | "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1; 536 | LD_RUNPATH_SEARCH_PATHS = ( 537 | "$(inherited)", 538 | "@executable_path/Frameworks", 539 | "@loader_path/Frameworks", 540 | ); 541 | MARKETING_VERSION = 3.4.7; 542 | MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; 543 | PRODUCT_BUNDLE_IDENTIFIER = jp.mond.krimpedance.KRProgressHUD; 544 | PRODUCT_NAME = "$(TARGET_NAME)"; 545 | PROVISIONING_PROFILE_SPECIFIER = ""; 546 | SKIP_INSTALL = YES; 547 | }; 548 | name = Release; 549 | }; 550 | /* End XCBuildConfiguration section */ 551 | 552 | /* Begin XCConfigurationList section */ 553 | 4B7576E51D1BCD56003FF258 /* Build configuration list for PBXNativeTarget "KRProgressHUDTests" */ = { 554 | isa = XCConfigurationList; 555 | buildConfigurations = ( 556 | 4B7576E61D1BCD56003FF258 /* Debug */, 557 | 4B7576E71D1BCD56003FF258 /* Release */, 558 | ); 559 | defaultConfigurationIsVisible = 0; 560 | defaultConfigurationName = Release; 561 | }; 562 | 4BA70C2A1D02F28D009EB743 /* Build configuration list for PBXProject "KRProgressHUD" */ = { 563 | isa = XCConfigurationList; 564 | buildConfigurations = ( 565 | 4BA70C361D02F28D009EB743 /* Debug */, 566 | 4BA70C371D02F28D009EB743 /* Release */, 567 | ); 568 | defaultConfigurationIsVisible = 0; 569 | defaultConfigurationName = Release; 570 | }; 571 | 4BA70C381D02F28D009EB743 /* Build configuration list for PBXNativeTarget "KRProgressHUD" */ = { 572 | isa = XCConfigurationList; 573 | buildConfigurations = ( 574 | 4BA70C391D02F28D009EB743 /* Debug */, 575 | 4BA70C3A1D02F28D009EB743 /* Release */, 576 | ); 577 | defaultConfigurationIsVisible = 0; 578 | defaultConfigurationName = Release; 579 | }; 580 | /* End XCConfigurationList section */ 581 | }; 582 | rootObject = 4BA70C271D02F28D009EB743 /* Project object */; 583 | } 584 | -------------------------------------------------------------------------------- /KRProgressHUD.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /KRProgressHUD.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /KRProgressHUD.xcodeproj/xcshareddata/xcschemes/KRProgressHUD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 63 | 69 | 70 | 71 | 72 | 78 | 79 | 85 | 86 | 87 | 88 | 90 | 91 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /KRProgressHUD/Classes/Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extensions.swift 3 | // KRProgressHUD 4 | // 5 | // Copyright © 2017 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | // MARK: - UIApplication extension ------------ 11 | 12 | extension UIApplication { 13 | func topViewController(_ base: UIViewController? = nil) -> UIViewController? { 14 | let base = base ?? keyWindow?.rootViewController 15 | if let top = (base as? UINavigationController)?.topViewController { 16 | return topViewController(top) 17 | } 18 | if let selected = (base as? UITabBarController)?.selectedViewController { 19 | return topViewController(selected) 20 | } 21 | if let presented = base?.presentedViewController { 22 | return topViewController(presented) 23 | } 24 | return base 25 | } 26 | } 27 | 28 | // MARK: - NSLayoutConstraint extension ------------ 29 | 30 | extension NSLayoutConstraint { 31 | convenience init(item view1: Any, attribute attr1: NSLayoutConstraint.Attribute, relatedBy relation: NSLayoutConstraint.Relation = .equal, toItem view2: Any? = nil, attribute attr2: NSLayoutConstraint.Attribute? = nil, constant: CGFloat = 0) { 32 | self.init(item: view1, attribute: attr1, relatedBy: relation, toItem: view2, attribute: attr2 ?? attr1, multiplier: 1.0, constant: constant) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /KRProgressHUD/Classes/InnerKRProgressHUD.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InnerKRProgressHUD.swift 3 | // KRProgressHUD 4 | // 5 | // Copyright © 2016 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | private let fadeTime = Double(0.2) 11 | private let hudViewMargin = CGFloat(50) 12 | private let hudViewPadding = CGFloat(15) 13 | private let iconViewSize = CGSize(width: 50, height: 50) 14 | private let messageLabelTopMargin = CGFloat(10) 15 | private let messageLabelMinWidth = CGFloat(120) 16 | 17 | // MARK: - Internal actions -------------------------- 18 | 19 | extension KRProgressHUD { 20 | func configureProgressHUDView() { 21 | window.windowLevel = .normal 22 | hudViewController.view.translatesAutoresizingMaskIntoConstraints = false 23 | 24 | hudView.backgroundColor = .white 25 | hudView.layer.cornerRadius = 10 26 | hudView.translatesAutoresizingMaskIntoConstraints = false 27 | 28 | iconView.backgroundColor = .clear 29 | iconView.isHidden = false 30 | iconView.translatesAutoresizingMaskIntoConstraints = false 31 | 32 | activityIndicatorView.frame.size = iconViewSize 33 | activityIndicatorView.animating = false 34 | activityIndicatorView.hidesWhenStopped = true 35 | 36 | iconDrawingView.frame.size = iconViewSize 37 | iconDrawingView.backgroundColor = .clear 38 | iconDrawingView.isHidden = true 39 | 40 | iconDrawingLayer.frame.size = iconViewSize 41 | iconDrawingLayer.lineWidth = 0 42 | iconDrawingLayer.fillColor = nil 43 | 44 | imageView.frame.size = iconViewSize 45 | imageView.backgroundColor = .clear 46 | imageView.contentMode = .scaleAspectFit 47 | imageView.isHidden = true 48 | 49 | messageLabel.backgroundColor = .clear 50 | messageLabel.textAlignment = .center 51 | messageLabel.adjustsFontSizeToFitWidth = true 52 | messageLabel.minimumScaleFactor = 0.5 53 | messageLabel.numberOfLines = 0 54 | messageLabel.translatesAutoresizingMaskIntoConstraints = false 55 | 56 | iconDrawingView.layer.addSublayer(iconDrawingLayer) 57 | iconView.addSubview(imageView) 58 | iconView.addSubview(iconDrawingView) 59 | iconView.addSubview(activityIndicatorView) 60 | hudView.addSubview(iconView) 61 | hudView.addSubview(messageLabel) 62 | hudViewController.view.addSubview(hudView) 63 | window.rootViewController = hudViewController 64 | 65 | setUpConstraints() 66 | applyStyles() 67 | } 68 | 69 | func show(withMessage message: String?, 70 | iconType: KRProgressHUDIconType? = nil, 71 | image: UIImage? = nil, 72 | imageSize: CGSize? = nil, 73 | isOnlyText: Bool = false, 74 | isLoading: Bool = false, 75 | completion: CompletionHandler? = nil) { 76 | DispatchQueue.main.async { [unowned self] in 77 | self.applyStyles() 78 | self.updateLayouts(message: message, iconType: iconType, image: image, imageSize: imageSize, isOnlyText: isOnlyText) 79 | self.isLoading = isLoading 80 | 81 | if let graceTime = self.graceTime, graceTime > 0 { 82 | let timer = Timer(timeInterval: graceTime, target: self, selector: #selector(self.handleGraceTimer), userInfo: nil, repeats: false) 83 | RunLoop.current.add(timer, forMode: .common) 84 | self.graceTimer = timer 85 | } else { 86 | self.shoHudView(isLoading: isLoading, completion: completion) 87 | } 88 | } 89 | } 90 | 91 | func dismiss(completion: CompletionHandler?) { 92 | DispatchQueue.main.async { [unowned self] in 93 | self.graceTimer?.invalidate() 94 | self.fadeOutView(completion: completion) 95 | } 96 | } 97 | 98 | private func shoHudView(isLoading: Bool, completion: CompletionHandler? = nil) { 99 | let deadline = self.cancelCurrentDismissHandler() ? 0 : fadeTime 100 | DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + deadline) { 101 | self.graceTimer?.invalidate() 102 | self.fadeInView(completion: completion) 103 | if isLoading { return } 104 | self.registerDismissHandler() 105 | } 106 | } 107 | 108 | @objc private func handleGraceTimer() { 109 | if graceTimer?.isValid ?? false { 110 | shoHudView(isLoading: isLoading, completion: nil) 111 | } 112 | } 113 | } 114 | 115 | // MARK: - Private actions -------------------------- 116 | 117 | extension KRProgressHUD { 118 | func setUpConstraints() { 119 | hudViewCenterYConstraint = NSLayoutConstraint(item: hudView, attribute: .centerY, toItem: hudViewController.view, constant: viewOffset ?? viewAppearance.viewOffset) 120 | hudViewSideMarginConstraints += [ 121 | NSLayoutConstraint(item: hudView, attribute: .left, relatedBy: .greaterThanOrEqual, toItem: hudViewController.view, constant: hudViewMargin), 122 | NSLayoutConstraint(item: hudView, attribute: .right, relatedBy: .lessThanOrEqual, toItem: hudViewController.view, constant: -hudViewMargin) 123 | ] 124 | 125 | iconViewConstraints += [ 126 | NSLayoutConstraint(item: iconView, attribute: .top, toItem: hudView, constant: hudViewPadding), 127 | NSLayoutConstraint(item: iconView, attribute: .centerX, toItem: hudView), 128 | NSLayoutConstraint(item: iconView, attribute: .left, relatedBy: .greaterThanOrEqual, toItem: hudView, constant: hudViewPadding), 129 | NSLayoutConstraint(item: iconView, attribute: .right, relatedBy: .lessThanOrEqual, toItem: hudView, constant: -hudViewPadding), 130 | NSLayoutConstraint(item: iconView, attribute: .bottom, relatedBy: .lessThanOrEqual, toItem: hudView, constant: -hudViewPadding) 131 | ] 132 | 133 | messageLabelMinWidthConstraint = NSLayoutConstraint(item: messageLabel, attribute: .width, relatedBy: .greaterThanOrEqual, constant: messageLabelMinWidth) 134 | messageLabelConstraints += [ 135 | messageLabelMinWidthConstraint, 136 | NSLayoutConstraint(item: messageLabel, attribute: .top, toItem: iconView, attribute: .bottom, constant: messageLabelTopMargin), 137 | NSLayoutConstraint(item: messageLabel, attribute: .top, relatedBy: .greaterThanOrEqual, toItem: hudView, constant: hudViewPadding), 138 | NSLayoutConstraint(item: messageLabel, attribute: .left, toItem: hudView, constant: hudViewPadding), 139 | NSLayoutConstraint(item: messageLabel, attribute: .right, toItem: hudView, constant: -hudViewPadding), 140 | NSLayoutConstraint(item: messageLabel, attribute: .bottom, toItem: hudView, constant: -hudViewPadding) 141 | ] 142 | 143 | hudViewController.view.addConstraints([ 144 | NSLayoutConstraint(item: hudView, attribute: .centerX, toItem: hudViewController.view), 145 | hudViewCenterYConstraint 146 | ] + hudViewSideMarginConstraints) 147 | hudView.addConstraints(iconViewConstraints + messageLabelConstraints) 148 | iconView.addConstraints([ 149 | NSLayoutConstraint(item: iconView, attribute: .width, constant: iconViewSize.width), 150 | NSLayoutConstraint(item: iconView, attribute: .height, constant: iconViewSize.height) 151 | ]) 152 | } 153 | 154 | func cancelCurrentDismissHandler() -> Bool { 155 | guard let handler = dismissHandler else { return true } 156 | defer { dismissHandler = nil } 157 | handler.cancel() 158 | return handler.isCancelled 159 | } 160 | 161 | func registerDismissHandler() { 162 | dismissHandler = DispatchWorkItem { [unowned self] in 163 | KRProgressHUD.dismiss() 164 | _ = self.cancelCurrentDismissHandler() 165 | } 166 | let duration = DispatchTime.now() + (self.duration ?? viewAppearance.duration) 167 | DispatchQueue.global().asyncAfter(deadline: duration, execute: dismissHandler!) 168 | } 169 | 170 | func fadeInView(completion: CompletionHandler?) { 171 | if KRProgressHUD.isVisible { 172 | hudView.alpha = 0 173 | } else { 174 | hudViewController.view.alpha = 0 175 | if let presentingVC = presentingViewController { 176 | window.rootViewController = nil 177 | presentingVC.addChild(hudViewController) 178 | presentingVC.view.addSubview(hudViewController.view) 179 | setConstraintsToPresentingVC() 180 | presentingVC.didMove(toParent: hudViewController) 181 | } else { 182 | if #available(iOS 13.0, *) { 183 | if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene { 184 | window.windowScene = windowScene 185 | } else { 186 | print("UIWindowScene not found") 187 | } 188 | } 189 | window.makeKeyAndVisible() 190 | } 191 | } 192 | 193 | KRProgressHUD.isVisible = true 194 | UIView.animate(withDuration: fadeTime, animations: { [unowned self] in 195 | self.hudView.alpha = 1 196 | self.hudViewController.view.alpha = 1 197 | }, completion: { _ in 198 | completion?() 199 | }) 200 | } 201 | 202 | func fadeOutView(completion: CompletionHandler?) { 203 | UIView.animate(withDuration: fadeTime, animations: { [unowned self] in 204 | self.hudViewController.view.alpha = 0 205 | }, completion: { [unowned self] _ in 206 | self.window.isHidden = true 207 | if self.presentingViewController != nil { 208 | self.hudViewController.willMove(toParent: nil) 209 | self.hudViewController.view.removeFromSuperview() 210 | self.hudViewController.removeFromParent() 211 | self.presentingViewController = nil 212 | self.window.rootViewController = self.hudViewController 213 | } 214 | self.activityIndicatorView.stopAnimating() 215 | KRProgressHUD.isVisible = false 216 | completion?() 217 | }) 218 | } 219 | 220 | func applyStyles() { 221 | hudView.backgroundColor = style?.backgroundColor ?? viewAppearance.style.backgroundColor 222 | messageLabel.textColor = style?.textColor ?? viewAppearance.style.textColor 223 | iconDrawingLayer.fillColor = style?.iconColor?.cgColor ?? viewAppearance.style.iconColor?.cgColor 224 | hudViewController.view.backgroundColor = maskType?.maskColor ?? viewAppearance.maskType.maskColor 225 | activityIndicatorView.colors = activityIndicatorColors ?? viewAppearance.activityIndicatorColors 226 | messageLabel.font = font ?? viewAppearance.font 227 | } 228 | 229 | func resetLayouts() { 230 | iconView.isHidden = false 231 | activityIndicatorView.stopAnimating() 232 | iconDrawingView.isHidden = true 233 | iconDrawingLayer.path = nil 234 | imageView.image = nil 235 | imageView.isHidden = true 236 | messageLabel.isHidden = false 237 | hudViewCenterYConstraint.constant = viewOffset ?? viewAppearance.viewOffset 238 | hudViewSideMarginConstraints.forEach { $0.isActive = true } 239 | iconViewConstraints.forEach { $0.isActive = true } 240 | messageLabelConstraints.forEach { $0.isActive = true } 241 | } 242 | 243 | func updateLayouts(message: String?, iconType: KRProgressHUDIconType?, image: UIImage?, imageSize: CGSize?, isOnlyText: Bool) { 244 | resetLayouts() 245 | messageLabel.text = message 246 | 247 | if isOnlyText { 248 | iconView.isHidden = true 249 | iconViewConstraints.forEach { $0.isActive = false } 250 | messageLabelMinWidthConstraint.isActive = false 251 | return 252 | } 253 | 254 | if message == nil { 255 | messageLabel.isHidden = true 256 | messageLabelConstraints.forEach { $0.isActive = false } 257 | hudViewSideMarginConstraints.forEach { $0.isActive = false } 258 | } 259 | 260 | switch (iconType, image) { 261 | case (nil, nil): 262 | activityIndicatorView.startAnimating() 263 | 264 | case (nil, let image): 265 | imageView.isHidden = false 266 | let size = imageSize ?? image!.size 267 | imageView.contentMode = size.width < imageView.bounds.width && size.height < imageView.bounds.height ? .center : .scaleAspectFit 268 | imageView.image = image 269 | 270 | case (let iconType, _): 271 | iconDrawingView.isHidden = false 272 | iconDrawingLayer.path = iconType!.getPath() 273 | iconDrawingLayer.fillColor = iconDrawingLayer.fillColor ?? iconType!.getColor() 274 | } 275 | } 276 | 277 | func setConstraintsToPresentingVC() { 278 | guard let view = presentingViewController?.view, view == hudViewController.view.superview else { return } 279 | view.addConstraints([ 280 | NSLayoutConstraint(item: hudViewController.view!, attribute: .top, toItem: view), 281 | NSLayoutConstraint(item: hudViewController.view!, attribute: .bottom, toItem: view), 282 | NSLayoutConstraint(item: hudViewController.view!, attribute: .left, toItem: view), 283 | NSLayoutConstraint(item: hudViewController.view!, attribute: .right, toItem: view) 284 | ]) 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /KRProgressHUD/Classes/KRProgressHUD.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRProgressHUD.swift 3 | // KRProgressHUD 4 | // 5 | // Copyright © 2016 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | import KRActivityIndicatorView 10 | 11 | /// Type of KRProgressHUD's background view. 12 | /// 13 | /// - clear: `UIColor.clear`. 14 | /// - white: `UIColor(white: 1, alpho: 0.2)`. 15 | /// - black: `UIColor(white: 0, alpho: 0.2)`. Default type. 16 | /// - custom: You can set custom mask color. 17 | public enum KRProgressHUDMaskType { 18 | case clear, white, black, custom(color: UIColor) 19 | 20 | var maskColor: UIColor { 21 | switch self { 22 | case .clear: return .clear 23 | case .white: return UIColor(white: 1, alpha: 0.2) 24 | case .black: return UIColor(white: 0, alpha: 0.2) 25 | case .custom(let color): return color 26 | } 27 | } 28 | } 29 | 30 | /// Style of KRProgressHUD 31 | /// 32 | /// - white: HUD's backgroundColor is `.white`. HUD's text color is `.black`. Default style. 33 | /// - black: HUD's backgroundColor is `.black`. HUD's text color is `.white`. 34 | /// - custom: You can set custom color of HUD's background, text and glyph icon. 35 | /// If you set nil to `icon`, it's shown in original color. 36 | public enum KRProgressHUDStyle { 37 | case white 38 | case black 39 | case custom(background: UIColor, text: UIColor, icon: UIColor?) 40 | 41 | var backgroundColor: UIColor { 42 | switch self { 43 | case .white: return .white 44 | case .black: return .black 45 | case let .custom(background, _, _): return background 46 | } 47 | } 48 | 49 | var textColor: UIColor { 50 | switch self { 51 | case .white: return .black 52 | case .black: return .white 53 | case let .custom(_, text, _): return text 54 | } 55 | } 56 | 57 | var iconColor: UIColor? { 58 | switch self { 59 | case let .custom(_, _, icon): return icon 60 | default: return nil 61 | } 62 | } 63 | } 64 | 65 | /// KRProgressHUD is a beautiful and easy-to-use progress HUD. 66 | public final class KRProgressHUD { 67 | public typealias CompletionHandler = () -> Void 68 | 69 | public class KRProgressHUDAppearance { 70 | /// Default style. 71 | public var style = KRProgressHUDStyle.white 72 | /// Default mask type. 73 | public var maskType = KRProgressHUDMaskType.black 74 | /// Default KRActivityIndicatorView colors 75 | public var activityIndicatorColors = [UIColor]([.black, .lightGray]) 76 | /// Default message label font. 77 | public var font = UIFont.systemFont(ofSize: 13) 78 | /// Default HUD center offset of y axis. 79 | public var viewOffset = CGFloat(0.0) 80 | /// Default duration to show HUD. 81 | public var duration = Double(1.0) 82 | 83 | @available(*, deprecated, message: "Use activityIndicatorColors") 84 | public var activityIndicatorStyle = KRActivityIndicatorViewStyle.gradationColor(head: .black, tail: .lightGray) { 85 | didSet { activityIndicatorColors = [activityIndicatorStyle.headColor, activityIndicatorStyle.tailColor] } 86 | } 87 | @available(*, renamed: "duration") 88 | public var deadline = Double(1.0) { 89 | didSet { duration = deadline } 90 | } 91 | 92 | fileprivate init() {} 93 | } 94 | 95 | static let shared = KRProgressHUD() 96 | 97 | let viewAppearance = KRProgressHUDAppearance() 98 | 99 | let window = UIWindow(frame: UIScreen.main.bounds) 100 | let hudViewController = KRProgressHUDViewController() 101 | 102 | let hudView = UIView() 103 | let iconView = UIView() 104 | let activityIndicatorView = KRActivityIndicatorView() 105 | let iconDrawingView = UIView() 106 | let iconDrawingLayer = CAShapeLayer() 107 | let imageView = UIImageView() 108 | let messageLabel = UILabel() 109 | 110 | var style: KRProgressHUDStyle? 111 | var maskType: KRProgressHUDMaskType? 112 | var activityIndicatorColors: [UIColor]? 113 | var font: UIFont? 114 | var viewOffset: CGFloat? 115 | var duration: Double? 116 | var graceTime: Double? 117 | var isLoading = false 118 | 119 | var graceTimer: Timer? 120 | 121 | var hudViewCenterYConstraint: NSLayoutConstraint! 122 | var hudViewSideMarginConstraints = [NSLayoutConstraint]() 123 | var iconViewConstraints = [NSLayoutConstraint]() 124 | var messageLabelConstraints = [NSLayoutConstraint]() 125 | var messageLabelMinWidthConstraint: NSLayoutConstraint! 126 | 127 | var dismissHandler: DispatchWorkItem? 128 | weak var presentingViewController: UIViewController? 129 | 130 | /// This have whether HUD is indicated. 131 | public internal(set) static var isVisible = false 132 | 133 | private init() { 134 | configureProgressHUDView() 135 | } 136 | } 137 | 138 | // MARK: - Set styles -------------------------- 139 | 140 | extension KRProgressHUD { 141 | /// Returns the appearance proxy for the receiver. 142 | /// 143 | /// - Returns: The appearance proxy for the receiver. 144 | public static func appearance() -> KRProgressHUDAppearance { 145 | return shared.viewAppearance 146 | } 147 | 148 | /// Sets the HUD style. 149 | /// This value is cleared by `resetStyles()`. 150 | /// 151 | /// - Parameter style: KRProgressHUDStyle 152 | /// - Returns: KRProgressHUD.Type (discardable) 153 | @discardableResult public static func set(style: KRProgressHUDStyle) -> KRProgressHUD.Type { 154 | shared.style = style 155 | return KRProgressHUD.self 156 | } 157 | 158 | /// Sets the HUD mask type. 159 | /// This value is cleared by `resetStyles()`. 160 | /// 161 | /// - Parameter maskType: KRProgressHUDMaskType 162 | /// - Returns: KRProgressHUD.Type (discardable) 163 | @discardableResult public static func set(maskType: KRProgressHUDMaskType) -> KRProgressHUD.Type { 164 | shared.maskType = maskType 165 | return KRProgressHUD.self 166 | } 167 | 168 | /// Sets the KRActivityIndicatorView gradient colors. 169 | /// This value is cleared by `resetStyles()`. 170 | /// 171 | /// - Parameter colors: KRActivityIndicatorViewStyle 172 | /// - Returns: KRProgressHUD.Type (discardable) 173 | @discardableResult public static func set(activityIndicatorViewColors colors: [UIColor]) -> KRProgressHUD.Type { 174 | shared.activityIndicatorColors = colors 175 | return KRProgressHUD.self 176 | } 177 | 178 | /// Sets the HUD message label font. 179 | /// This value is cleared by `resetStyles()`. 180 | /// 181 | /// - Parameter font: The message label font. 182 | /// - Returns: KRProgressHUD.Type (discardable) 183 | @discardableResult public static func set(font: UIFont) -> KRProgressHUD.Type { 184 | shared.font = font 185 | return KRProgressHUD.self 186 | } 187 | 188 | /// Sets the HUD center offset of y axis. 189 | /// This value is cleared by `resetStyles()`. 190 | /// 191 | /// - Parameter offset: The HUD center offset of y axis. 192 | /// - Returns: KRProgressHUD.Type (discardable) 193 | @discardableResult public static func set(viewOffset offset: CGFloat) -> KRProgressHUD.Type { 194 | shared.viewOffset = offset 195 | return KRProgressHUD.self 196 | } 197 | 198 | /** 199 | 200 | This value is cleared by `resetStyles()`. 201 | 202 | - parameter time: 203 | 204 | - returns: 205 | */ 206 | /// Sets duration to show HUD. 207 | /// 208 | /// This is used: 209 | /// - `showSuccess()` 210 | /// - `showInfo()` 211 | /// - `showWarning()` 212 | /// - `showError()` 213 | /// - `showImage()` 214 | /// - `showMessage()` 215 | /// 216 | /// - Parameter time: Deadline time. 217 | /// - Returns: KRProgressHUD.Type (discardable) 218 | @discardableResult public static func set(duration: Double) -> KRProgressHUD.Type { 219 | shared.duration = duration 220 | return KRProgressHUD.self 221 | } 222 | 223 | @discardableResult public static func set(graceTime: Double) -> KRProgressHUD.Type { 224 | shared.graceTime = graceTime 225 | return KRProgressHUD.self 226 | } 227 | 228 | /// Resets the HUD styles. 229 | /// 230 | /// - Returns: KRProgressHUD.Type (discardable) 231 | @discardableResult public static func resetStyles() -> KRProgressHUD.Type { 232 | shared.style = nil 233 | shared.maskType = nil 234 | shared.activityIndicatorColors = nil 235 | shared.font = nil 236 | shared.viewOffset = nil 237 | shared.duration = nil 238 | return KRProgressHUD.self 239 | } 240 | 241 | /// Sets the view controller which presents HUD. 242 | /// This is applied only once. 243 | /// 244 | /// - Parameter viewController: Presenting view controller. 245 | /// - Returns: KRProgressHUD.Type 246 | public static func showOn(_ viewController: UIViewController) -> KRProgressHUD.Type { 247 | shared.presentingViewController = viewController 248 | return KRProgressHUD.self 249 | } 250 | 251 | @available(*, deprecated, message: "Use set(activityIndicatorViewColors:)") 252 | @discardableResult public static func set(activityIndicatorViewStyle style: KRActivityIndicatorViewStyle) -> KRProgressHUD.Type { 253 | shared.activityIndicatorColors = [style.headColor, style.tailColor] 254 | return KRProgressHUD.self 255 | } 256 | 257 | @available(*, renamed: "set(ducation:)") 258 | @discardableResult public static func set(deadline time: Double) -> KRProgressHUD.Type { 259 | shared.duration = time 260 | return KRProgressHUD.self 261 | } 262 | } 263 | 264 | // MARK: - Show, Update & Dismiss ------------ 265 | 266 | extension KRProgressHUD { 267 | /// Shows the HUD. 268 | /// You can appoint only the args which You want to appoint. 269 | /// 270 | /// - Parameters: 271 | /// - message: HUD's message. 272 | /// - completion: Handler when showing is completed. 273 | public static func show(withMessage message: String? = nil, completion: CompletionHandler? = nil) { 274 | shared.show(withMessage: message, isLoading: true, completion: completion) 275 | } 276 | 277 | /// Shows the HUD with success glyph. 278 | /// The HUD dismiss after `duration` secound. 279 | /// 280 | /// - Parameter message: HUD's message. 281 | public static func showSuccess(withMessage message: String? = nil) { 282 | shared.show(withMessage: message, iconType: .success) 283 | } 284 | 285 | /// Shows the HUD with information glyph. 286 | /// The HUD dismiss after `duration` secound. 287 | /// 288 | /// - Parameter message: HUD's message. 289 | public static func showInfo(withMessage message: String? = nil) { 290 | shared.show(withMessage: message, iconType: .info) 291 | } 292 | 293 | /// Shows the HUD with warning glyph. 294 | /// The HUD dismiss after `duration` secound. 295 | /// 296 | /// - Parameter message: HUD's message. 297 | public static func showWarning(withMessage message: String? = nil) { 298 | shared.show(withMessage: message, iconType: .warning) 299 | } 300 | 301 | /// Shows the HUD with error glyph. 302 | /// The HUD dismiss after `duration` secound. 303 | /// 304 | /// - Parameter message: HUD's message. 305 | public static func showError(withMessage message: String? = nil) { 306 | shared.show(withMessage: message, iconType: .error) 307 | } 308 | 309 | /// Shows the HUD with image. 310 | /// The HUD dismiss after `duration` secound. 311 | /// 312 | /// - Parameters: 313 | /// - image: Image that display instead of activity indicator. 314 | /// - size: Image size. 315 | /// - message: HUD's message. 316 | public static func showImage(_ image: UIImage, size: CGSize? = nil, message: String? = nil) { 317 | shared.show(withMessage: message, image: image, imageSize: size) 318 | } 319 | 320 | /// Shows the message only HUD. 321 | /// The HUD dismiss after `duration` secound. 322 | /// 323 | /// - Parameter message: HUD's message. 324 | public static func showMessage(_ message: String) { 325 | shared.show(withMessage: message, isOnlyText: true) 326 | } 327 | 328 | /// Updates the HUD message. 329 | /// 330 | /// - Parameter message: Message. 331 | public static func update(message: String) { 332 | shared.messageLabel.text = message 333 | } 334 | 335 | /// Hides the HUD. 336 | /// 337 | /// - Parameter completion: Hide completion handler. 338 | public static func dismiss(_ completion: CompletionHandler? = nil) { 339 | shared.dismiss(completion: completion) 340 | } 341 | } 342 | -------------------------------------------------------------------------------- /KRProgressHUD/Classes/KRProgressHUDIconType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRProgressHUDIconType.swift 3 | // KRProgressHUD 4 | // 5 | // Copyright © 2016 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | enum KRProgressHUDIconType { 11 | case success, info, warning, error 12 | 13 | func getPath() -> CGPath { 14 | switch self { 15 | case .success: return self.success 16 | case .info: return self.info 17 | case .warning: return self.warning 18 | case .error: return self.error 19 | } 20 | } 21 | 22 | func getColor() -> CGColor { 23 | switch self { 24 | case .success: return UIColor(red: 0.353, green: 0.620, blue: 0.431, alpha: 1).cgColor 25 | case .info: return UIColor(red: 0.361, green: 0.522, blue: 0.800, alpha: 1).cgColor 26 | case .warning: return UIColor(red: 0.918, green: 0.855, blue: 0.110, alpha: 1).cgColor 27 | case .error: return UIColor(red: 0.718, green: 0.255, blue: 0.255, alpha: 1).cgColor 28 | } 29 | } 30 | } 31 | 32 | private extension KRProgressHUDIconType { 33 | var success: CGPath { 34 | let path = UIBezierPath() 35 | path.move(to: CGPoint(x: 19.886, y: 45.665)) 36 | path.addLine(to: CGPoint(x: 0.644, y: 24.336)) 37 | path.addLine(to: CGPoint(x: 4.356, y: 20.987)) 38 | path.addLine(to: CGPoint(x: 19.712, y: 38.007)) 39 | path.addLine(to: CGPoint(x: 45.569, y: 6.575)) 40 | path.addLine(to: CGPoint(x: 49.431, y: 9.752)) 41 | path.addLine(to: CGPoint(x: 19.886, y: 45.665)) 42 | return path.cgPath 43 | } 44 | 45 | var info: CGPath { 46 | let path = UIBezierPath(ovalIn: CGRect(x: 21.078, y: 5, width: 7.843, height: 7.843)) 47 | path.move(to: CGPoint(x: 28.137, y: 43.431)) 48 | path.addLine(to: CGPoint(x: 28.137, y: 18.333)) 49 | path.addLine(to: CGPoint(x: 18.725, y: 18.333)) 50 | path.addLine(to: CGPoint(x: 18.725, y: 19.902)) 51 | path.addLine(to: CGPoint(x: 21.863, y: 19.902)) 52 | path.addLine(to: CGPoint(x: 21.863, y: 43.431)) 53 | path.addLine(to: CGPoint(x: 18.725, y: 43.431)) 54 | path.addLine(to: CGPoint(x: 18.725, y: 45)) 55 | path.addLine(to: CGPoint(x: 31.275, y: 45)) 56 | path.addLine(to: CGPoint(x: 31.275, y: 43.431)) 57 | path.addLine(to: CGPoint(x: 28.137, y: 43.431)) 58 | return path.cgPath 59 | } 60 | 61 | var warning: CGPath { 62 | let path = UIBezierPath() 63 | path.move(to: CGPoint(x: 29.821, y: 42.679)) 64 | path.addCurve(to: CGPoint(x: 25, y: 47.5), controlPoint1: CGPoint(x: 29.821, y: 45.341), controlPoint2: CGPoint(x: 27.663, y: 47.5)) 65 | path.addCurve(to: CGPoint(x: 20.179, y: 42.679), controlPoint1: CGPoint(x: 22.337, y: 47.5), controlPoint2: CGPoint(x: 20.179, y: 45.341)) 66 | path.addCurve(to: CGPoint(x: 25, y: 37.857), controlPoint1: CGPoint(x: 20.179, y: 40.016), controlPoint2: CGPoint(x: 22.337, y: 37.857)) 67 | path.addCurve(to: CGPoint(x: 29.821, y: 42.679), controlPoint1: CGPoint(x: 27.663, y: 37.857), controlPoint2: CGPoint(x: 29.821, y: 40.016)) 68 | path.move(to: CGPoint(x: 24.5, y: 32.5)) 69 | path.addCurve(to: CGPoint(x: 24.112, y: 31.211), controlPoint1: CGPoint(x: 24.5, y: 32.5), controlPoint2: CGPoint(x: 24.359, y: 32.031)) 70 | path.addCurve(to: CGPoint(x: 23.698, y: 29.731), controlPoint1: CGPoint(x: 23.988, y: 30.801), controlPoint2: CGPoint(x: 23.849, y: 30.303)) 71 | path.addCurve(to: CGPoint(x: 23.19, y: 27.813), controlPoint1: CGPoint(x: 23.548, y: 29.16), controlPoint2: CGPoint(x: 23.36, y: 28.516)) 72 | path.addCurve(to: CGPoint(x: 22.046, y: 23.008), controlPoint1: CGPoint(x: 22.844, y: 26.406), controlPoint2: CGPoint(x: 22.435, y: 24.766)) 73 | path.addCurve(to: CGPoint(x: 21, y: 17.5), controlPoint1: CGPoint(x: 21.658, y: 21.25), controlPoint2: CGPoint(x: 21.314, y: 19.375)) 74 | path.addCurve(to: CGPoint(x: 20.309, y: 14.702), controlPoint1: CGPoint(x: 20.841, y: 16.563), controlPoint2: CGPoint(x: 20.578, y: 15.625)) 75 | path.addCurve(to: CGPoint(x: 19.791, y: 11.992), controlPoint1: CGPoint(x: 20.043, y: 13.779), controlPoint2: CGPoint(x: 19.813, y: 12.871)) 76 | path.addCurve(to: CGPoint(x: 20.145, y: 9.458), controlPoint1: CGPoint(x: 19.769, y: 11.113), controlPoint2: CGPoint(x: 19.906, y: 10.264)) 77 | path.addCurve(to: CGPoint(x: 20.985, y: 7.188), controlPoint1: CGPoint(x: 20.361, y: 8.652), controlPoint2: CGPoint(x: 20.65, y: 7.891)) 78 | path.addCurve(to: CGPoint(x: 22.07, y: 5.269), controlPoint1: CGPoint(x: 21.307, y: 6.484), controlPoint2: CGPoint(x: 21.69, y: 5.84)) 79 | path.addCurve(to: CGPoint(x: 23.207, y: 3.789), controlPoint1: CGPoint(x: 22.437, y: 4.697), controlPoint2: CGPoint(x: 22.857, y: 4.199)) 80 | path.addCurve(to: CGPoint(x: 24.124, y: 2.837), controlPoint1: CGPoint(x: 23.562, y: 3.379), controlPoint2: CGPoint(x: 23.878, y: 3.057)) 81 | path.addCurve(to: CGPoint(x: 24.5, y: 2.5), controlPoint1: CGPoint(x: 24.369, y: 2.617), controlPoint2: CGPoint(x: 24.5, y: 2.5)) 82 | path.addLine(to: CGPoint(x: 25.5, y: 2.5)) 83 | path.addCurve(to: CGPoint(x: 25.876, y: 2.837), controlPoint1: CGPoint(x: 25.5, y: 2.5), controlPoint2: CGPoint(x: 25.631, y: 2.617)) 84 | path.addCurve(to: CGPoint(x: 26.793, y: 3.789), controlPoint1: CGPoint(x: 26.122, y: 3.057), controlPoint2: CGPoint(x: 26.438, y: 3.379)) 85 | path.addCurve(to: CGPoint(x: 27.93, y: 5.269), controlPoint1: CGPoint(x: 27.143, y: 4.199), controlPoint2: CGPoint(x: 27.563, y: 4.697)) 86 | path.addCurve(to: CGPoint(x: 29.015, y: 7.188), controlPoint1: CGPoint(x: 28.31, y: 5.84), controlPoint2: CGPoint(x: 28.693, y: 6.484)) 87 | path.addCurve(to: CGPoint(x: 29.855, y: 9.458), controlPoint1: CGPoint(x: 29.35, y: 7.891), controlPoint2: CGPoint(x: 29.639, y: 8.652)) 88 | path.addCurve(to: CGPoint(x: 30.209, y: 11.992), controlPoint1: CGPoint(x: 30.094, y: 10.264), controlPoint2: CGPoint(x: 30.231, y: 11.113)) 89 | path.addCurve(to: CGPoint(x: 29.691, y: 14.702), controlPoint1: CGPoint(x: 30.187, y: 12.871), controlPoint2: CGPoint(x: 29.957, y: 13.779)) 90 | path.addCurve(to: CGPoint(x: 29, y: 17.5), controlPoint1: CGPoint(x: 29.422, y: 15.625), controlPoint2: CGPoint(x: 29.159, y: 16.563)) 91 | path.addCurve(to: CGPoint(x: 27.954, y: 23.008), controlPoint1: CGPoint(x: 28.686, y: 19.375), controlPoint2: CGPoint(x: 28.342, y: 21.25)) 92 | path.addCurve(to: CGPoint(x: 26.81, y: 27.813), controlPoint1: CGPoint(x: 27.565, y: 24.766), controlPoint2: CGPoint(x: 27.156, y: 26.406)) 93 | path.addCurve(to: CGPoint(x: 26.302, y: 29.731), controlPoint1: CGPoint(x: 26.64, y: 28.516), controlPoint2: CGPoint(x: 26.452, y: 29.16)) 94 | path.addCurve(to: CGPoint(x: 25.888, y: 31.211), controlPoint1: CGPoint(x: 26.151, y: 30.303), controlPoint2: CGPoint(x: 26.012, y: 30.801)) 95 | path.addCurve(to: CGPoint(x: 25.5, y: 32.5), controlPoint1: CGPoint(x: 25.641, y: 32.031), controlPoint2: CGPoint(x: 25.5, y: 32.5)) 96 | path.addLine(to: CGPoint(x: 24.5, y: 32.5)) 97 | return path.cgPath 98 | } 99 | 100 | var error: CGPath { 101 | let path = UIBezierPath() 102 | path.move(to: CGPoint(x: 48.535, y: 8.535)) 103 | path.addLine(to: CGPoint(x: 41.465, y: 1.465)) 104 | path.addLine(to: CGPoint(x: 25, y: 17.93)) 105 | path.addLine(to: CGPoint(x: 8.535, y: 1.465)) 106 | path.addLine(to: CGPoint(x: 1.465, y: 8.535)) 107 | path.addLine(to: CGPoint(x: 17.93, y: 25)) 108 | path.addLine(to: CGPoint(x: 1.465, y: 41.465)) 109 | path.addLine(to: CGPoint(x: 8.535, y: 48.535)) 110 | path.addLine(to: CGPoint(x: 25, y: 32.07)) 111 | path.addLine(to: CGPoint(x: 41.465, y: 48.535)) 112 | path.addLine(to: CGPoint(x: 48.535, y: 41.465)) 113 | path.addLine(to: CGPoint(x: 32.07, y: 25)) 114 | path.addLine(to: CGPoint(x: 48.535, y: 8.535)) 115 | return path.cgPath 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /KRProgressHUD/Classes/KRProgressHUDViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRProgressHUDViewController.swift 3 | // KRProgressHUD 4 | // 5 | // Copyright © 2016 Krimpedance. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | class KRProgressHUDViewController: UIViewController { 11 | var statusBarStyle = UIStatusBarStyle.default 12 | var statusBarHidden = false 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | } 17 | 18 | override var preferredStatusBarStyle: UIStatusBarStyle { 19 | guard let topVC = UIApplication.shared.topViewController() else { return statusBarStyle } 20 | if !topVC.isKind(of: KRProgressHUDViewController.self) { 21 | statusBarStyle = topVC.preferredStatusBarStyle 22 | } 23 | return statusBarStyle 24 | } 25 | 26 | override var prefersStatusBarHidden: Bool { 27 | guard let topVC = UIApplication.shared.topViewController() else { return statusBarHidden } 28 | if !topVC.isKind(of: KRProgressHUDViewController.self) { 29 | statusBarHidden = topVC.prefersStatusBarHidden 30 | } 31 | return statusBarHidden 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /KRProgressHUD/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /KRProgressHUD/KRProgressHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // KRProgressHUD.h 3 | // KRProgressHUD 4 | // 5 | // Created by Ryunosuke Kirikihira on 2016/06/04. 6 | // Copyright © 2016年 Krimpedance. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for KRProgressHUD. 12 | FOUNDATION_EXPORT double KRProgressHUDVersionNumber; 13 | 14 | //! Project version string for KRProgressHUD. 15 | FOUNDATION_EXPORT const unsigned char KRProgressHUDVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /KRProgressHUD/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | NSPrivacyCollectedDataTypes 8 | 9 | NSPrivacyTrackingDomains 10 | 11 | NSPrivacyTracking 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /KRProgressHUDTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /KRProgressHUDTests/KRProgressHUDTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KRProgressHUDTests.swift 3 | // KRProgressHUDTests 4 | // 5 | // Copyright © 2016 Krimpedance. All rights reserved. 6 | // 7 | 8 | import XCTest 9 | @testable import KRProgressHUD 10 | import KRActivityIndicatorView 11 | 12 | class KRProgressHUDTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | } 17 | 18 | override func tearDown() { 19 | super.tearDown() 20 | } 21 | 22 | // MARK: - Apply styles -------------- 23 | 24 | func testApplyStyles() { 25 | // Initial style test 26 | XCTAssertEqual(KRProgressHUD.shared.hudView.backgroundColor, .white) 27 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.textColor, .black) 28 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.fillColor, nil) 29 | XCTAssertEqual(KRProgressHUD.shared.hudViewController.view.backgroundColor, UIColor(white: 0, alpha: 0.2)) 30 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.headColor, .black) 31 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.tailColor, .lightGray) 32 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.font, UIFont.systemFont(ofSize: 13)) 33 | 34 | KRProgressHUD.appearance().style = .custom(background: .red, text: .white, icon: .green) 35 | KRProgressHUD.appearance().maskType = .clear 36 | KRProgressHUD.appearance().activityIndicatorColors = [.yellow] 37 | KRProgressHUD.appearance().font = UIFont.systemFont(ofSize: 20) 38 | 39 | KRProgressHUD.shared.applyStyles() 40 | 41 | // Set appearance style test 42 | XCTAssertEqual(KRProgressHUD.shared.hudView.backgroundColor, .red) 43 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.textColor, .white) 44 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.fillColor, UIColor.green.cgColor) 45 | XCTAssertEqual(KRProgressHUD.shared.hudViewController.view.backgroundColor, .clear) 46 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.headColor, .yellow) 47 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.tailColor, .yellow) 48 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.font, UIFont.systemFont(ofSize: 20)) 49 | 50 | KRProgressHUD 51 | .set(style: .custom(background: .red, text: .orange, icon: .black)) 52 | .set(maskType: .white) 53 | .set(activityIndicatorViewColors: [.red, .blue]) 54 | .set(font: UIFont.systemFont(ofSize: 10)) 55 | .shared 56 | .applyStyles() 57 | 58 | // Set style test 59 | XCTAssertEqual(KRProgressHUD.shared.hudView.backgroundColor, .red) 60 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.textColor, .orange) 61 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.fillColor, UIColor.black.cgColor) 62 | XCTAssertEqual(KRProgressHUD.shared.hudViewController.view.backgroundColor, UIColor(white: 1, alpha: 0.2)) 63 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.headColor, .red) 64 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.tailColor, .blue) 65 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.font, UIFont.systemFont(ofSize: 10)) 66 | 67 | KRProgressHUD 68 | .resetStyles() 69 | .shared 70 | .applyStyles() 71 | 72 | // Reset style test 73 | XCTAssertEqual(KRProgressHUD.shared.hudView.backgroundColor, .red) 74 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.textColor, .white) 75 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.fillColor, UIColor.green.cgColor) 76 | XCTAssertEqual(KRProgressHUD.shared.hudViewController.view.backgroundColor, .clear) 77 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.headColor, .yellow) 78 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.tailColor, .yellow) 79 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.font, UIFont.systemFont(ofSize: 20)) 80 | } 81 | 82 | // MARK: - Layout -------------- 83 | 84 | func testLayouts() { 85 | let image = UIImage() 86 | 87 | KRProgressHUD.shared.configureProgressHUDView() 88 | 89 | // Initial layout test 90 | XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) 91 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) 92 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) 93 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) 94 | XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) 95 | XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) 96 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) 97 | 98 | // loading 99 | KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: nil, imageSize: nil, isOnlyText: false) 100 | XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) 101 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, true) 102 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) 103 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) 104 | XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) 105 | XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) 106 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, true) 107 | 108 | // loading with message 109 | KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, imageSize: nil, isOnlyText: false) 110 | XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) 111 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, true) 112 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) 113 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) 114 | XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) 115 | XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) 116 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) 117 | 118 | // icon 119 | KRProgressHUD.shared.updateLayouts(message: nil, iconType: .success, image: nil, imageSize: nil, isOnlyText: false) 120 | XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) 121 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) 122 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, false) 123 | XCTAssert(KRProgressHUD.shared.iconDrawingLayer.path != nil) 124 | XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) 125 | XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) 126 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, true) 127 | 128 | // icon with message 129 | KRProgressHUD.shared.updateLayouts(message: "test", iconType: .info, image: nil, imageSize: nil, isOnlyText: false) 130 | XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) 131 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) 132 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, false) 133 | XCTAssert(KRProgressHUD.shared.iconDrawingLayer.path != nil) 134 | XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) 135 | XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) 136 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) 137 | 138 | // image 139 | KRProgressHUD.shared.updateLayouts(message: nil, iconType: nil, image: image, imageSize: nil, isOnlyText: false) 140 | XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) 141 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) 142 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) 143 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) 144 | XCTAssertEqual(KRProgressHUD.shared.imageView.image, image) 145 | XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, false) 146 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, true) 147 | 148 | // image with message 149 | KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: image, imageSize: nil, isOnlyText: false) 150 | XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, false) 151 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) 152 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) 153 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) 154 | XCTAssertEqual(KRProgressHUD.shared.imageView.image, image) 155 | XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, false) 156 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) 157 | 158 | // test conly 159 | KRProgressHUD.shared.updateLayouts(message: "test", iconType: nil, image: nil, imageSize: nil, isOnlyText: true) 160 | XCTAssertEqual(KRProgressHUD.shared.iconView.isHidden, true) 161 | XCTAssertEqual(KRProgressHUD.shared.activityIndicatorView.isAnimating, false) 162 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingView.isHidden, true) 163 | XCTAssertEqual(KRProgressHUD.shared.iconDrawingLayer.path, nil) 164 | XCTAssertEqual(KRProgressHUD.shared.imageView.image, nil) 165 | XCTAssertEqual(KRProgressHUD.shared.imageView.isHidden, true) 166 | XCTAssertEqual(KRProgressHUD.shared.messageLabel.isHidden, false) 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 krimpedance 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "KRProgressHUD", 7 | platforms: [.iOS(.v12)], 8 | products: [ 9 | .library( 10 | name: "KRProgressHUD", 11 | targets: ["KRProgressHUD"]), 12 | ], 13 | dependencies: [ 14 | .package(url: "https://github.com/krimpedance/KRActivityIndicatorView.git", from: "3.0.8"), 15 | ], 16 | targets: [ 17 | .target( 18 | name: "KRProgressHUD", 19 | dependencies: ["KRActivityIndicatorView"], 20 | path: "KRProgressHUD/Classes" 21 | ), 22 | .testTarget( 23 | name: "KRProgressHUDTests", 24 | dependencies: ["KRProgressHUD", "KRActivityIndicatorView"], 25 | path: "KRProgressHUDTests" 26 | ), 27 | ] 28 | ) 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [日本語](./README_Ja.md) 2 | 3 | 4 | 5 | [![Version](https://img.shields.io/cocoapods/v/KRProgressHUD.svg?style=flat)](http://cocoapods.org/pods/KRProgressHUD) 6 | [![License](https://img.shields.io/cocoapods/l/KRProgressHUD.svg?style=flat)](http://cocoapods.org/pods/KRProgressHUD) 7 | [![Platform](https://img.shields.io/cocoapods/p/KRProgressHUD.svg?style=flat)](http://cocoapods.org/pods/KRProgressHUD) 8 | [![Download](https://img.shields.io/cocoapods/dt/KRProgressHUD.svg?style=flat)](http://cocoapods.org/pods/KRProgressHUD) 9 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 10 | [![CI Status](http://img.shields.io/travis/krimpedance/KRProgressHUD.svg?style=flat)](https://travis-ci.org/krimpedance/KRProgressHUD) 11 | 12 | `KRProgressHUD` is a beautiful and easy-to-use progress HUD for your iOS written by Swift. 13 | 14 | [KRActivityIndicatorView](https://github.com/krimpedance/KRActivityIndicatorView) is used for loading view. 15 | 16 | 17 | 18 | 19 | ## Features 20 | - Round indicator 21 | - Indicator color can be customized 22 | 23 | ## Requirements 24 | - iOS 9.0+ 25 | - Xcode 12.0+ 26 | - Swift 5.3+ 27 | 28 | ## DEMO 29 | To run the example project, clone the repo, and open `KRProgressHUDDemo.xcodeproj` from the DEMO directory. 30 | 31 | or [appetize.io](https://appetize.io/app/nw022juw0znkf1n5u6ynga5ntm) 32 | 33 | ## Installation 34 | KRProgressHUD is available through [CocoaPods](http://cocoapods.org) and [Carthage](https://github.com/Carthage/Carthage). 35 | To install it, simply add the following line to your Podfile or Cartfile: 36 | 37 | ```ruby 38 | # CocoaPods 39 | pod "KRProgressHUD" 40 | ``` 41 | 42 | ```ruby 43 | # Carthage 44 | github "Krimpedance/KRProgressHUD" 45 | ``` 46 | 47 | ## Usage 48 | (see sample Xcode project in /Demo) 49 | 50 | #### Caution : 51 | **Only use it if you absolutely need to perform a task before taking the user forward.** 52 | 53 | **If you want to use it with other cases (ex. pull to refresh), I suggest using [KRActivityIndicatorView](https://github.com/krimpedance/KRActivityIndicatorView).** 54 | 55 | 56 | `KRProgressHUD` is created as a singleton. 57 | 58 | At first, import `KRProgressHUD` in your swift file. 59 | 60 | 61 | Show simple HUD : 62 | ```Swift 63 | KRProgressHUD.show() 64 | 65 | DispatchQueue.main.asyncAfter(deadline: .now()+1) { 66 | KRProgressHUD.dismiss() 67 | } 68 | ``` 69 | 70 | ### Showing the HUD 71 | 72 | ```Swift 73 | class func show(withMessage message:String? = nil, completion: CompleteHandler? = nil) 74 | 75 | // Example 76 | KRProgressHUD.show() 77 | KRProgressHUD.show(withMessage: "Loading...") 78 | KRProgressHUD.show(withMessage: "Loading...") { 79 | print("Complete handler") 80 | } 81 | ``` 82 | 83 | **Show on ViewController** 84 | 85 | If you want to show HUD on a view controller, set at `showOn()`. 86 | 87 | (This is applied only once.) 88 | 89 | ```Swift 90 | KRProgressHUD.showOn(viewController).show() 91 | ``` 92 | 93 | Show a confirmation glyph before getting dismissed a little bit later. 94 | (The display time is 1 sec in default. You can change the timing.) 95 | 96 | ```Swift 97 | class func showSuccess() 98 | class func showInfo() 99 | class func showWarning() 100 | class func showError() 101 | class func showImage() // This can set custom image. (Max size is 50x50) 102 | ``` 103 | 104 | Show the HUD (only message) 105 | 106 | ```Swift 107 | public class func showMessage(_ message: String) 108 | 109 | // Example 110 | KRProgressHUD.showMessage("Completed! \n Let's start!") 111 | ``` 112 | 113 | ### Update the HUD's message 114 | The HUD can update message. 115 | 116 | ```Swift 117 | class func update(message: String) 118 | 119 | // Example 120 | KRProgressHUD.update(message: "20%") 121 | ``` 122 | 123 | ### Dismissing the HUD 124 | The HUD can be dismissed using: 125 | 126 | ```Swift 127 | class func dismiss(_ completion: CompleteHandler? = nil) 128 | ``` 129 | 130 | ### Customization 131 | `KRProgressHUD.appearance()` can set default styles. 132 | 133 | ```Swift 134 | class KRProgressHUDAppearance { 135 | /// Default style. 136 | public var style = KRProgressHUDStyle.white 137 | /// Default mask type. 138 | public var maskType = KRProgressHUDMaskType.black 139 | /// Default KRActivityIndicatorView colors 140 | public var activityIndicatorColors = [UIColor]([.black, .lightGray]) 141 | /// Default message label font. 142 | public var font = UIFont.systemFont(ofSize: 13) 143 | /// Default HUD center offset of y axis. 144 | public var viewOffset = CGFloat(0.0) 145 | /// Default duration to show HUD. 146 | public var duration = Double(1.0) 147 | } 148 | ``` 149 | 150 | When you'd like to make styles reflected only in specific situation, use following methods. 151 | 152 | ```Swift 153 | @discardableResult public class func set(style: KRProgressHUDStyle) -> KRProgressHUD.Type 154 | @discardableResult public class func set(maskType: KRProgressHUDMaskType) -> KRProgressHUD.Type 155 | @discardableResult public class func set(activityIndicatorViewColors colors: [UIColor]) -> KRProgressHUD.Type 156 | @discardableResult public class func set(font: UIFont) -> KRProgressHUD.Type 157 | @discardableResult public class func set(viewOffset offset: CGFloat) -> KRProgressHUD.Type 158 | @discardableResult public class func set(duration: Double) -> KRProgressHUD.Type 159 | 160 | 161 | // Example 162 | KRProgressHUD 163 | .set(style: .custom(background: .blue, text: .white, icon: nil)) 164 | .set(maskType: .white) 165 | .show() 166 | ``` 167 | 168 | These `set()` setting can be reset by 169 | 170 | ```Swift 171 | @discardableResult public class func resetStyles() -> KRProgressHUD.Type 172 | ``` 173 | 174 | ## Contributing to this project 175 | I'm seeking bug reports and feature requests. 176 | 177 | ## Release Note 178 | + 3.4.8 : 179 | - Add privacy manifests 180 | 181 | + 3.4.7 : 182 | - Support for iOS 11 and below 183 | 184 | ## License 185 | KRProgressHUD is available under the MIT license. 186 | 187 | See the LICENSE file for more info. 188 | -------------------------------------------------------------------------------- /README_Ja.md: -------------------------------------------------------------------------------- 1 | [English](./README.md) 2 | 3 | 4 | 5 | [![Version](https://img.shields.io/cocoapods/v/KRProgressHUD.svg?style=flat)](http://cocoapods.org/pods/KRProgressHUD) 6 | [![License](https://img.shields.io/cocoapods/l/KRProgressHUD.svg?style=flat)](http://cocoapods.org/pods/KRProgressHUD) 7 | [![Platform](https://img.shields.io/cocoapods/p/KRProgressHUD.svg?style=flat)](http://cocoapods.org/pods/KRProgressHUD) 8 | [![Download](https://img.shields.io/cocoapods/dt/KRProgressHUD.svg?style=flat)](http://cocoapods.org/pods/KRProgressHUD) 9 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 10 | [![CI Status](http://img.shields.io/travis/krimpedance/KRProgressHUD.svg?style=flat)](https://travis-ci.org/krimpedance/KRProgressHUD) 11 | 12 | `KRProgressHUD`は, Swiftで書かれた綺麗で使いやすいローディング画面を表示するライブラリです. 13 | 14 | インジケータには[KRActivityIndicatorView](https://github.com/krimpedance/KRActivityIndicatorView)を使用しています. 15 | 16 | 17 | 18 | 19 | ## 特徴 20 | - 丸いインジケータ 21 | - カラーのカスタマイズ性 22 | 23 | ## 必要環境 24 | - iOS 9.0+ 25 | - Xcode 12.0+ 26 | - Swift 5.3+ 27 | 28 | ## デモ 29 | `DEMO/`以下にあるサンプルプロジェクトから確認してください. 30 | 31 | または, [Appetize.io](https://appetize.io/app/nw022juw0znkf1n5u6ynga5ntm)にてシュミレートしてください. 32 | 33 | ## インストール 34 | KRProgressHUDは[CocoaPods](http://cocoapods.org)と[Carthage](https://github.com/Carthage/Carthage)で 35 | インストールすることができます. 36 | 37 | ```ruby 38 | # Podfile 39 | pod "KRProgressHUD" 40 | ``` 41 | 42 | ```ruby 43 | # Cartfile 44 | github "Krimpedance/KRProgressHUD" 45 | ``` 46 | 47 | ## 使い方 48 | (`/Demo`以下のサンプルを見てみてください) 49 | 50 | #### 注意 : 51 | **このライブラリは同期通信のようなユーザの操作を止めて処理を行うときなどに使用してください** 52 | 53 | **PullRefreshなど, 他の場面で使用したい場合は, [KRActivityIndicatorView](https://github.com/krimpedance/KRActivityIndicator)を使用することをお勧めします** 54 | 55 | 56 | `KRProgressHUD`はシングルトンパターンで作られています. 57 | 58 | まず, `KRProgressHUD`をインポートします. 59 | 60 | GCDを使用した一番簡単な表示: 61 | ```Swift 62 | KRProgressHUD.show() 63 | 64 | DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) { 65 | KRProgressHUD.dismiss() 66 | } 67 | ``` 68 | 69 | ### HUDの表示 70 | 71 | ```Swift 72 | class func show(withMessage message:String? = nil, completion: CompleteHandler? = nil) 73 | 74 | // 例 75 | KRProgressHUD.show() 76 | KRProgressHUD.show(withMessage: "Loading...") 77 | KRProgressHUD.show(withMessage: "Loading...") { 78 | print("Complete handler") 79 | } 80 | ``` 81 | 82 | **ViewController上に表示** 83 | 84 | もしViewController上にHUDを表示したいときは, `showOn()` で設定してください. 85 | 86 | この設定は一度だけ適用されます. 87 | 88 | ```Swift 89 | KRProgressHUD.showOn(viewController).show() 90 | ``` 91 | 92 | HUDを閉じる前に, 成功やエラーなどの情報をアイコン付きで表示することもできます. 93 | (表示は1秒間. 秒数は設定可能です.) 94 | 95 | ```Swift 96 | class func showSuccess() 97 | class func showInfo() 98 | class func showWarning() 99 | class func showError() 100 | class func showImage() // 好きな画像を設定できます. (最大サイズは50x50です) 101 | ``` 102 | 103 | メッセージだけのHUDを表示 104 | 105 | ```Swift 106 | public class func showMessage(_ message: String) 107 | 108 | // 例 109 | KRProgressHUD.showText("完了しました! \n 早速始めましょう!") 110 | ``` 111 | 112 | ### HUDのメッセージの更新 113 | パーセンテージの表示などのために, メッセージの更新メソッドがあります. 114 | 115 | ```Swift 116 | class func update(text: String) 117 | 118 | // 例 119 | KRProgressHUD.update(text: "20%") 120 | ``` 121 | 122 | ### HUDを閉じる 123 | HUDを閉じるときは, 以下を実行します. 124 | 125 | ```Swift 126 | class func dismiss(_ completion: CompleteHandler? = nil) 127 | ``` 128 | 129 | ## カスタマイズ 130 | `KRProgressHUD.appearance()` では, 標準のスタイルを設定できます. 131 | 132 | ```Swift 133 | class KRProgressHUDAppearance { 134 | /// HUDのスタイル. 135 | public var style = KRProgressHUDStyle.white 136 | /// マスクタイプ 137 | public var maskType = KRProgressHUDMaskType.black 138 | /// ローディングインジケータのグラデーションカラー 139 | public var activityIndicatorColors = [UIColor]([.black, .lightGray]) 140 | /// ラベルのフォント 141 | public var font = UIFont.systemFont(ofSize: 13) 142 | /// HUDのセンター位置 143 | public var viewCenterPosition = CGPoint(x: UIScreen.main.bounds.width/2, y: UIScreen.main.bounds.height/2) 144 | /// HUDの表示時間. 145 | public var duration = Double(1.0) 146 | } 147 | ``` 148 | 149 | 特定の場面だけでスタイルを適用したいときは, 以下の関数を使用できます. 150 | 151 | ```Swift 152 | @discardableResult public class func set(style: KRProgressHUDStyle) -> KRProgressHUD.Type 153 | @discardableResult public class func set(maskType: KRProgressHUDMaskType) -> KRProgressHUD.Type 154 | @discardableResult public class func set(activityIndicatorViewColors colors: [UIColor]) -> KRProgressHUD.Type 155 | @discardableResult public class func set(font: UIFont) -> KRProgressHUD.Type 156 | @discardableResult public class func set(centerPosition point: CGPoint) -> KRProgressHUD.Type 157 | @discardableResult public class func set(duration: Double) -> KRProgressHUD.Type 158 | 159 | 160 | // 例 161 | KRProgressHUD 162 | .set(style: .custom(background: .blue, text: .white, icon: nil)) 163 | .set(maskType: .white) 164 | .show() 165 | ``` 166 | 167 | `set()` で設定したスタイルは以下の関数でリセットできます. 168 | 169 | ```Swift 170 | @discardableResult public class func resetStyles() -> KRProgressHUD.Type 171 | ``` 172 | 173 | 174 | ## ライブラリに関する質問等 175 | バグや機能のリクエストがありましたら, 気軽にコメントしてください. 176 | 177 | ## リリースノート 178 | + 3.4.8 : 179 | - PrivacyInfo.xcprivacy を追加 180 | 181 | + 3.4.7 : 182 | - iOS 11 以下をサポート 183 | 184 | ## ライセンス 185 | KRProgressHUDはMITライセンスに準拠しています. 186 | 187 | 詳しくは`LICENSE`ファイルをみてください. 188 | --------------------------------------------------------------------------------