├── .gitattributes ├── .gitignore ├── Examples └── DragAndDropToDownload │ ├── DragAndDropToDownload.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── DragAndDropToDownload.xcworkspace │ └── contents.xcworkspacedata │ ├── DragAndDropToDownload │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ └── Main.storyboard │ ├── DragAndDropToDownload.entitlements │ ├── DragView.h │ ├── DragView.m │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m │ ├── Podfile │ ├── Podfile.lock │ └── Pods │ ├── Headers │ ├── Private │ │ └── MPOFinderFileDownloader │ │ │ ├── MPOFileDownloading.h │ │ │ ├── MPOFinderFileDownloadStatusUpdater.h │ │ │ ├── MPOFinderFileDownloader.h │ │ │ ├── MPOSimpleFileDownloader.h │ │ │ └── MPOThroughputHistory.h │ └── Public │ │ └── MPOFinderFileDownloader │ │ ├── MPOFileDownloading.h │ │ ├── MPOFinderFileDownloadStatusUpdater.h │ │ ├── MPOFinderFileDownloader.h │ │ ├── MPOSimpleFileDownloader.h │ │ └── MPOThroughputHistory.h │ ├── Local Podspecs │ └── MPOFinderFileDownloader.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ └── project.pbxproj │ └── Target Support Files │ ├── MPOFinderFileDownloader │ ├── MPOFinderFileDownloader-dummy.m │ ├── MPOFinderFileDownloader-prefix.pch │ └── MPOFinderFileDownloader.xcconfig │ └── Pods-DragAndDropToDownload │ ├── Pods-DragAndDropToDownload-acknowledgements.markdown │ ├── Pods-DragAndDropToDownload-acknowledgements.plist │ ├── Pods-DragAndDropToDownload-dummy.m │ ├── Pods-DragAndDropToDownload-frameworks.sh │ ├── Pods-DragAndDropToDownload-resources.sh │ ├── Pods-DragAndDropToDownload.debug.xcconfig │ └── Pods-DragAndDropToDownload.release.xcconfig ├── LICENSE ├── MPOFinderFileDownloader.podspec ├── MPOFinderFileDownloader ├── MPOFileDownloading.h ├── MPOFinderFileDownloadStatusUpdater.h ├── MPOFinderFileDownloadStatusUpdater.m ├── MPOFinderFileDownloader.h ├── MPOFinderFileDownloader.m ├── MPOSimpleFileDownloader.h ├── MPOSimpleFileDownloader.m ├── MPOThroughputHistory.h └── MPOThroughputHistory.m ├── README.md └── screenshot.gif /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C653AD4520072F040020F066 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C653AD4420072F040020F066 /* Accelerate.framework */; }; 11 | C656D69E2005C3A500721877 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C656D69D2005C3A500721877 /* AppDelegate.m */; }; 12 | C656D6A12005C3A500721877 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C656D6A02005C3A500721877 /* ViewController.m */; }; 13 | C656D6A32005C3A500721877 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C656D6A22005C3A500721877 /* Assets.xcassets */; }; 14 | C656D6A62005C3A500721877 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C656D6A42005C3A500721877 /* Main.storyboard */; }; 15 | C656D6A92005C3A500721877 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C656D6A82005C3A500721877 /* main.m */; }; 16 | C656D6B22005C43E00721877 /* DragView.m in Sources */ = {isa = PBXBuildFile; fileRef = C656D6B12005C43E00721877 /* DragView.m */; }; 17 | D5CCCCB7C5132ED0AA231FBD /* libPods-DragAndDropToDownload.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DB042DFB5652EB783C02D5E /* libPods-DragAndDropToDownload.a */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 1DB042DFB5652EB783C02D5E /* libPods-DragAndDropToDownload.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-DragAndDropToDownload.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | C653AD4420072F040020F066 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 23 | C656D6992005C3A500721877 /* DragAndDropToDownload.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DragAndDropToDownload.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | C656D69C2005C3A500721877 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | C656D69D2005C3A500721877 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | C656D69F2005C3A500721877 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 27 | C656D6A02005C3A500721877 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 28 | C656D6A22005C3A500721877 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | C656D6A52005C3A500721877 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 30 | C656D6A72005C3A500721877 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | C656D6A82005C3A500721877 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32 | C656D6AA2005C3A500721877 /* DragAndDropToDownload.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DragAndDropToDownload.entitlements; sourceTree = ""; }; 33 | C656D6B02005C43E00721877 /* DragView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragView.h; sourceTree = ""; }; 34 | C656D6B12005C43E00721877 /* DragView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DragView.m; sourceTree = ""; }; 35 | DBF20AD71C2323E8465B428A /* Pods-DragAndDropToDownload.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DragAndDropToDownload.release.xcconfig"; path = "Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload.release.xcconfig"; sourceTree = ""; }; 36 | FE37C245B1CAEF06F8BB585C /* Pods-DragAndDropToDownload.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DragAndDropToDownload.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload.debug.xcconfig"; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | C656D6962005C3A500721877 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | C653AD4520072F040020F066 /* Accelerate.framework in Frameworks */, 45 | D5CCCCB7C5132ED0AA231FBD /* libPods-DragAndDropToDownload.a in Frameworks */, 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | 2AA7C7201DA17F3A9BCB34DD /* Pods */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | FE37C245B1CAEF06F8BB585C /* Pods-DragAndDropToDownload.debug.xcconfig */, 56 | DBF20AD71C2323E8465B428A /* Pods-DragAndDropToDownload.release.xcconfig */, 57 | ); 58 | name = Pods; 59 | sourceTree = ""; 60 | }; 61 | C578C620FC28B3492097C9B3 /* Frameworks */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | C653AD4420072F040020F066 /* Accelerate.framework */, 65 | 1DB042DFB5652EB783C02D5E /* libPods-DragAndDropToDownload.a */, 66 | ); 67 | name = Frameworks; 68 | sourceTree = ""; 69 | }; 70 | C656D6902005C3A500721877 = { 71 | isa = PBXGroup; 72 | children = ( 73 | C656D69B2005C3A500721877 /* DragAndDropToDownload */, 74 | C656D69A2005C3A500721877 /* Products */, 75 | 2AA7C7201DA17F3A9BCB34DD /* Pods */, 76 | C578C620FC28B3492097C9B3 /* Frameworks */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | C656D69A2005C3A500721877 /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | C656D6992005C3A500721877 /* DragAndDropToDownload.app */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | C656D69B2005C3A500721877 /* DragAndDropToDownload */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | C656D69C2005C3A500721877 /* AppDelegate.h */, 92 | C656D69D2005C3A500721877 /* AppDelegate.m */, 93 | C656D6B02005C43E00721877 /* DragView.h */, 94 | C656D6B12005C43E00721877 /* DragView.m */, 95 | C656D69F2005C3A500721877 /* ViewController.h */, 96 | C656D6A02005C3A500721877 /* ViewController.m */, 97 | C656D6A22005C3A500721877 /* Assets.xcassets */, 98 | C656D6A42005C3A500721877 /* Main.storyboard */, 99 | C656D6A72005C3A500721877 /* Info.plist */, 100 | C656D6A82005C3A500721877 /* main.m */, 101 | C656D6AA2005C3A500721877 /* DragAndDropToDownload.entitlements */, 102 | ); 103 | path = DragAndDropToDownload; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | C656D6982005C3A500721877 /* DragAndDropToDownload */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = C656D6AD2005C3A500721877 /* Build configuration list for PBXNativeTarget "DragAndDropToDownload" */; 112 | buildPhases = ( 113 | 94C17B958E1863D6BEA5CE53 /* [CP] Check Pods Manifest.lock */, 114 | C656D6952005C3A500721877 /* Sources */, 115 | C656D6962005C3A500721877 /* Frameworks */, 116 | C656D6972005C3A500721877 /* Resources */, 117 | 3CFA676783A5053BBABD342B /* [CP] Embed Pods Frameworks */, 118 | 0C86B369C9C36F8DA3F12432 /* [CP] Copy Pods Resources */, 119 | ); 120 | buildRules = ( 121 | ); 122 | dependencies = ( 123 | ); 124 | name = DragAndDropToDownload; 125 | productName = DragAndDropToDownload; 126 | productReference = C656D6992005C3A500721877 /* DragAndDropToDownload.app */; 127 | productType = "com.apple.product-type.application"; 128 | }; 129 | /* End PBXNativeTarget section */ 130 | 131 | /* Begin PBXProject section */ 132 | C656D6912005C3A500721877 /* Project object */ = { 133 | isa = PBXProject; 134 | attributes = { 135 | LastUpgradeCheck = 0920; 136 | ORGANIZATIONNAME = wutian; 137 | TargetAttributes = { 138 | C656D6982005C3A500721877 = { 139 | CreatedOnToolsVersion = 9.2; 140 | ProvisioningStyle = Automatic; 141 | }; 142 | }; 143 | }; 144 | buildConfigurationList = C656D6942005C3A500721877 /* Build configuration list for PBXProject "DragAndDropToDownload" */; 145 | compatibilityVersion = "Xcode 8.0"; 146 | developmentRegion = en; 147 | hasScannedForEncodings = 0; 148 | knownRegions = ( 149 | en, 150 | Base, 151 | ); 152 | mainGroup = C656D6902005C3A500721877; 153 | productRefGroup = C656D69A2005C3A500721877 /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | C656D6982005C3A500721877 /* DragAndDropToDownload */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | C656D6972005C3A500721877 /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | C656D6A32005C3A500721877 /* Assets.xcassets in Resources */, 168 | C656D6A62005C3A500721877 /* Main.storyboard in Resources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXResourcesBuildPhase section */ 173 | 174 | /* Begin PBXShellScriptBuildPhase section */ 175 | 0C86B369C9C36F8DA3F12432 /* [CP] Copy Pods Resources */ = { 176 | isa = PBXShellScriptBuildPhase; 177 | buildActionMask = 2147483647; 178 | files = ( 179 | ); 180 | inputPaths = ( 181 | ); 182 | name = "[CP] Copy Pods Resources"; 183 | outputPaths = ( 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | shellPath = /bin/sh; 187 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload-resources.sh\"\n"; 188 | showEnvVarsInLog = 0; 189 | }; 190 | 3CFA676783A5053BBABD342B /* [CP] Embed Pods Frameworks */ = { 191 | isa = PBXShellScriptBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | ); 195 | inputPaths = ( 196 | ); 197 | name = "[CP] Embed Pods Frameworks"; 198 | outputPaths = ( 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | shellPath = /bin/sh; 202 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload-frameworks.sh\"\n"; 203 | showEnvVarsInLog = 0; 204 | }; 205 | 94C17B958E1863D6BEA5CE53 /* [CP] Check Pods Manifest.lock */ = { 206 | isa = PBXShellScriptBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | ); 210 | inputPaths = ( 211 | ); 212 | name = "[CP] Check Pods Manifest.lock"; 213 | outputPaths = ( 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | shellPath = /bin/sh; 217 | shellScript = "diff \"${PODS_ROOT}/../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"; 218 | showEnvVarsInLog = 0; 219 | }; 220 | /* End PBXShellScriptBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | C656D6952005C3A500721877 /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | C656D6A12005C3A500721877 /* ViewController.m in Sources */, 228 | C656D6A92005C3A500721877 /* main.m in Sources */, 229 | C656D6B22005C43E00721877 /* DragView.m in Sources */, 230 | C656D69E2005C3A500721877 /* AppDelegate.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | C656D6A42005C3A500721877 /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | C656D6A52005C3A500721877 /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | /* End PBXVariantGroup section */ 246 | 247 | /* Begin XCBuildConfiguration section */ 248 | C656D6AB2005C3A500721877 /* Debug */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ALWAYS_SEARCH_USER_PATHS = NO; 252 | CLANG_ANALYZER_NONNULL = YES; 253 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 254 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 255 | CLANG_CXX_LIBRARY = "libc++"; 256 | CLANG_ENABLE_MODULES = YES; 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_COMMA = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 263 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 264 | CLANG_WARN_EMPTY_BODY = YES; 265 | CLANG_WARN_ENUM_CONVERSION = YES; 266 | CLANG_WARN_INFINITE_RECURSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 269 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 272 | CLANG_WARN_STRICT_PROTOTYPES = YES; 273 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 274 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 275 | CLANG_WARN_UNREACHABLE_CODE = YES; 276 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 277 | CODE_SIGN_IDENTITY = "Mac Developer"; 278 | COPY_PHASE_STRIP = NO; 279 | DEBUG_INFORMATION_FORMAT = dwarf; 280 | ENABLE_STRICT_OBJC_MSGSEND = YES; 281 | ENABLE_TESTABILITY = YES; 282 | GCC_C_LANGUAGE_STANDARD = gnu11; 283 | GCC_DYNAMIC_NO_PIC = NO; 284 | GCC_NO_COMMON_BLOCKS = YES; 285 | GCC_OPTIMIZATION_LEVEL = 0; 286 | GCC_PREPROCESSOR_DEFINITIONS = ( 287 | "DEBUG=1", 288 | "$(inherited)", 289 | ); 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | MACOSX_DEPLOYMENT_TARGET = 10.13; 297 | MTL_ENABLE_DEBUG_INFO = YES; 298 | ONLY_ACTIVE_ARCH = YES; 299 | SDKROOT = macosx; 300 | }; 301 | name = Debug; 302 | }; 303 | C656D6AC2005C3A500721877 /* Release */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | ALWAYS_SEARCH_USER_PATHS = NO; 307 | CLANG_ANALYZER_NONNULL = YES; 308 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 309 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 310 | CLANG_CXX_LIBRARY = "libc++"; 311 | CLANG_ENABLE_MODULES = YES; 312 | CLANG_ENABLE_OBJC_ARC = YES; 313 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 314 | CLANG_WARN_BOOL_CONVERSION = YES; 315 | CLANG_WARN_COMMA = YES; 316 | CLANG_WARN_CONSTANT_CONVERSION = 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_LITERAL_CONVERSION = YES; 325 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 326 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 327 | CLANG_WARN_STRICT_PROTOTYPES = YES; 328 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 329 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 330 | CLANG_WARN_UNREACHABLE_CODE = YES; 331 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 332 | CODE_SIGN_IDENTITY = "Mac Developer"; 333 | COPY_PHASE_STRIP = NO; 334 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 335 | ENABLE_NS_ASSERTIONS = NO; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu11; 338 | GCC_NO_COMMON_BLOCKS = YES; 339 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 341 | GCC_WARN_UNDECLARED_SELECTOR = YES; 342 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 343 | GCC_WARN_UNUSED_FUNCTION = YES; 344 | GCC_WARN_UNUSED_VARIABLE = YES; 345 | MACOSX_DEPLOYMENT_TARGET = 10.13; 346 | MTL_ENABLE_DEBUG_INFO = NO; 347 | SDKROOT = macosx; 348 | }; 349 | name = Release; 350 | }; 351 | C656D6AE2005C3A500721877 /* Debug */ = { 352 | isa = XCBuildConfiguration; 353 | baseConfigurationReference = FE37C245B1CAEF06F8BB585C /* Pods-DragAndDropToDownload.debug.xcconfig */; 354 | buildSettings = { 355 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 356 | CODE_SIGN_ENTITLEMENTS = DragAndDropToDownload/DragAndDropToDownload.entitlements; 357 | CODE_SIGN_STYLE = Automatic; 358 | COMBINE_HIDPI_IMAGES = YES; 359 | DEVELOPMENT_TEAM = DMJXDB9H6Q; 360 | INFOPLIST_FILE = DragAndDropToDownload/Info.plist; 361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 362 | MACOSX_DEPLOYMENT_TARGET = 10.12; 363 | PRODUCT_BUNDLE_IDENTIFIER = com.wutian.DragAndDropToDownload; 364 | PRODUCT_NAME = "$(TARGET_NAME)"; 365 | }; 366 | name = Debug; 367 | }; 368 | C656D6AF2005C3A500721877 /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | baseConfigurationReference = DBF20AD71C2323E8465B428A /* Pods-DragAndDropToDownload.release.xcconfig */; 371 | buildSettings = { 372 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 373 | CODE_SIGN_ENTITLEMENTS = DragAndDropToDownload/DragAndDropToDownload.entitlements; 374 | CODE_SIGN_STYLE = Automatic; 375 | COMBINE_HIDPI_IMAGES = YES; 376 | DEVELOPMENT_TEAM = DMJXDB9H6Q; 377 | INFOPLIST_FILE = DragAndDropToDownload/Info.plist; 378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 379 | MACOSX_DEPLOYMENT_TARGET = 10.12; 380 | PRODUCT_BUNDLE_IDENTIFIER = com.wutian.DragAndDropToDownload; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | }; 383 | name = Release; 384 | }; 385 | /* End XCBuildConfiguration section */ 386 | 387 | /* Begin XCConfigurationList section */ 388 | C656D6942005C3A500721877 /* Build configuration list for PBXProject "DragAndDropToDownload" */ = { 389 | isa = XCConfigurationList; 390 | buildConfigurations = ( 391 | C656D6AB2005C3A500721877 /* Debug */, 392 | C656D6AC2005C3A500721877 /* Release */, 393 | ); 394 | defaultConfigurationIsVisible = 0; 395 | defaultConfigurationName = Release; 396 | }; 397 | C656D6AD2005C3A500721877 /* Build configuration list for PBXNativeTarget "DragAndDropToDownload" */ = { 398 | isa = XCConfigurationList; 399 | buildConfigurations = ( 400 | C656D6AE2005C3A500721877 /* Debug */, 401 | C656D6AF2005C3A500721877 /* Release */, 402 | ); 403 | defaultConfigurationIsVisible = 0; 404 | defaultConfigurationName = Release; 405 | }; 406 | /* End XCConfigurationList section */ 407 | }; 408 | rootObject = C656D6912005C3A500721877 /* Project object */; 409 | } 410 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DragAndDropToDownload 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DragAndDropToDownload 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 18 | // Insert code here to initialize your application 19 | } 20 | 21 | 22 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 23 | // Insert code here to tear down your application 24 | } 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | Default 530 | 531 | 532 | 533 | 534 | 535 | 536 | Left to Right 537 | 538 | 539 | 540 | 541 | 542 | 543 | Right to Left 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | Default 555 | 556 | 557 | 558 | 559 | 560 | 561 | Left to Right 562 | 563 | 564 | 565 | 566 | 567 | 568 | Right to Left 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/DragAndDropToDownload.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | com.apple.security.network.client 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/DragView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DragView.h 3 | // DragFilePromises 4 | // 5 | // Created by 吴天 on 2018/1/9. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DragView : NSView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/DragView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DragView.m 3 | // DragFilePromises 4 | // 5 | // Created by 吴天 on 2018/1/9. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import "DragView.h" 10 | #import 11 | #import 12 | 13 | #define DownloadURL @"http://users.wfu.edu/yipcw/atg/vid/katamari-star8-10s-h264.mov" 14 | 15 | typedef NS_ENUM(NSInteger, DragViewState) { 16 | DragViewStateReady, 17 | DragViewStateDragging, 18 | DragViewStateDownloading, 19 | DragViewStateDownloadSuccess, 20 | }; 21 | 22 | @interface DragView () 23 | 24 | @property (nonatomic, assign) DragViewState state; 25 | @property (nonatomic, strong) MPOFinderFileDownloader * downloader; 26 | 27 | @end 28 | 29 | @implementation DragView 30 | 31 | - (instancetype)initWithFrame:(NSRect)frameRect 32 | { 33 | if (self = [super initWithFrame:frameRect]) { 34 | } 35 | return self; 36 | } 37 | 38 | - (void)setState:(DragViewState)state 39 | { 40 | if (_state != state) { 41 | _state = state; 42 | 43 | [self setNeedsDisplay:YES]; 44 | } 45 | } 46 | 47 | - (void)drawRect:(NSRect)dirtyRect 48 | { 49 | NSColor * backgroundColor = nil; 50 | NSColor * textColor = [NSColor whiteColor]; 51 | NSString * text = nil; 52 | 53 | switch (_state) { 54 | case DragViewStateReady: 55 | text = @"Drag Me to Desktop to Download"; 56 | backgroundColor = [NSColor colorWithRed:14.0/255 green:192.0/255 blue:0 alpha:1.0]; 57 | textColor = [NSColor whiteColor]; 58 | break; 59 | case DragViewStateDragging: 60 | text = @"Dragging"; 61 | backgroundColor = [NSColor colorWithWhite:0.8 alpha:1.0]; 62 | break; 63 | case DragViewStateDownloading: 64 | text = @"Downloading..."; 65 | backgroundColor = [NSColor colorWithWhite:0.8 alpha:1.0]; 66 | break; 67 | case DragViewStateDownloadSuccess: 68 | text = @"Downloaded"; 69 | backgroundColor = [NSColor colorWithRed:14.0/255 green:192.0/255 blue:0 alpha:1.0]; 70 | break; 71 | default: 72 | break; 73 | } 74 | 75 | CGContextRef ctx = (CGContextRef)[NSGraphicsContext currentContext].graphicsPort; 76 | CGContextSetFillColorWithColor(ctx, backgroundColor.CGColor); 77 | CGContextFillRect(ctx, dirtyRect); 78 | 79 | NSDictionary * textAttributes = @{NSFontAttributeName: [NSFont boldSystemFontOfSize:16], 80 | NSForegroundColorAttributeName: textColor 81 | }; 82 | 83 | NSSize size = [text sizeWithAttributes:textAttributes]; 84 | 85 | NSRect textRect = NSMakeRect((dirtyRect.size.width - size.width) / 2, (dirtyRect.size.height - size.height) / 2, size.width, size.height); 86 | 87 | [text drawInRect:textRect withAttributes:textAttributes]; 88 | } 89 | 90 | - (void)mouseDragged:(NSEvent *)event 91 | { 92 | [super mouseDragged:event]; 93 | 94 | if (_state != DragViewStateReady && 95 | _state != DragViewStateDownloadSuccess) { 96 | return; 97 | } 98 | 99 | NSFilePromiseProvider * provider = [[NSFilePromiseProvider alloc] initWithFileType:(NSString *)kUTTypeQuickTimeMovie delegate:self]; 100 | NSDraggingItem * dragItem = [[NSDraggingItem alloc] initWithPasteboardWriter:provider]; 101 | NSImage * image = [[NSImage alloc] initWithData:[self dataWithPDFInsideRect:[self bounds]]]; 102 | 103 | [dragItem setDraggingFrame:self.bounds contents:image]; 104 | 105 | [self beginDraggingSessionWithItems:@[dragItem] event:event source:self]; 106 | } 107 | 108 | - (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context 109 | { 110 | return NSDragOperationCopy; 111 | } 112 | 113 | - (void)draggingSession:(NSDraggingSession *)session willBeginAtPoint:(NSPoint)screenPoint 114 | { 115 | self.state = DragViewStateDragging; 116 | } 117 | 118 | - (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)screenPoint 119 | { 120 | self.state = DragViewStateDragging; 121 | } 122 | 123 | - (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation 124 | { 125 | if (operation != NSDragOperationCopy) { 126 | self.state = DragViewStateReady; 127 | } else { 128 | self.state = DragViewStateDownloading; 129 | } 130 | } 131 | 132 | - (NSString *)filePromiseProvider:(NSFilePromiseProvider*)filePromiseProvider fileNameForType:(NSString *)fileType 133 | { 134 | return [NSURL URLWithString:DownloadURL].path.lastPathComponent; 135 | } 136 | 137 | - (void)filePromiseProvider:(NSFilePromiseProvider*)filePromiseProvider writePromiseToURL:(NSURL *)url completionHandler:(void (^)(NSError * __nullable errorOrNil))completionHandler 138 | { 139 | _downloader = [[MPOFinderFileDownloader alloc] initWithUnderlyingDownloader:[[MPOSimpleFileDownloader alloc] init]]; 140 | 141 | [_downloader downloadURL:[NSURL URLWithString:DownloadURL] toPath:url.path progress:^(long long bytesWritten, long long totalBytesExpected) { 142 | 143 | } completion:^(NSError *error) { 144 | if (completionHandler) { 145 | completionHandler(error); 146 | } 147 | if (error){ 148 | self.state = DragViewStateReady; 149 | } else { 150 | self.state = DragViewStateDownloadSuccess; 151 | } 152 | }]; 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | NSHumanReadableCopyright 31 | Copyright © 2018年 wutian. All rights reserved. 32 | NSMainStoryboardFile 33 | Main 34 | NSPrincipalClass 35 | NSApplication 36 | 37 | 38 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DragAndDropToDownload 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : NSViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DragAndDropToDownload 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "DragView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic, strong) DragView * dragView; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | self.dragView = [[DragView alloc] initWithFrame:NSZeroRect]; 24 | [self.view addSubview:self.dragView]; 25 | } 26 | 27 | - (void)viewWillLayout 28 | { 29 | [super viewWillLayout]; 30 | 31 | self.dragView.frame = NSInsetRect(self.view.bounds, 50, 50); 32 | } 33 | 34 | - (void)setRepresentedObject:(id)representedObject { 35 | [super setRepresentedObject:representedObject]; 36 | 37 | // Update the view, if already loaded. 38 | } 39 | 40 | 41 | @end 42 | 43 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/DragAndDropToDownload/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DragAndDropToDownload 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Podfile: -------------------------------------------------------------------------------- 1 | target 'DragAndDropToDownload' 2 | pod 'MPOFinderFileDownloader', :path => '../../' -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MPOFinderFileDownloader (0.0.1) 3 | 4 | DEPENDENCIES: 5 | - MPOFinderFileDownloader (from `../../`) 6 | 7 | EXTERNAL SOURCES: 8 | MPOFinderFileDownloader: 9 | :path: "../../" 10 | 11 | SPEC CHECKSUMS: 12 | MPOFinderFileDownloader: 7d830d0626214b96db1ded2702a2bcd8be29a69f 13 | 14 | PODFILE CHECKSUM: c4aa15892dd9bb298764f12bfd068e4d5cd0335f 15 | 16 | COCOAPODS: 1.1.1 17 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Private/MPOFinderFileDownloader/MPOFileDownloading.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOFileDownloading.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Private/MPOFinderFileDownloader/MPOFinderFileDownloadStatusUpdater.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOFinderFileDownloadStatusUpdater.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Private/MPOFinderFileDownloader/MPOFinderFileDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOFinderFileDownloader.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Private/MPOFinderFileDownloader/MPOSimpleFileDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOSimpleFileDownloader.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Private/MPOFinderFileDownloader/MPOThroughputHistory.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOThroughputHistory.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Public/MPOFinderFileDownloader/MPOFileDownloading.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOFileDownloading.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Public/MPOFinderFileDownloader/MPOFinderFileDownloadStatusUpdater.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOFinderFileDownloadStatusUpdater.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Public/MPOFinderFileDownloader/MPOFinderFileDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOFinderFileDownloader.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Public/MPOFinderFileDownloader/MPOSimpleFileDownloader.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOSimpleFileDownloader.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Headers/Public/MPOFinderFileDownloader/MPOThroughputHistory.h: -------------------------------------------------------------------------------- 1 | ../../../../../../MPOFinderFileDownloader/MPOThroughputHistory.h -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Local Podspecs/MPOFinderFileDownloader.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MPOFinderFileDownloader", 3 | "version": "0.0.1", 4 | "authors": [ 5 | "Naituw" 6 | ], 7 | "summary": "A simple file downloader adds progress indicator to finder when downloading", 8 | "homepage": "https://github.com/Naituw/MPOFinderFileDownloader", 9 | "license": "Apache 2.0", 10 | "source": { 11 | "git": "https://github.com/Naituw/MPOFinderFileDownloader.git", 12 | "tag": "v0.0.1" 13 | }, 14 | "requires_arc": true, 15 | "frameworks": "Foundation", 16 | "platforms": { 17 | "osx": "10.9" 18 | }, 19 | "source_files": "MPOFinderFileDownloader/*.{h,m}" 20 | } 21 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MPOFinderFileDownloader (0.0.1) 3 | 4 | DEPENDENCIES: 5 | - MPOFinderFileDownloader (from `../../`) 6 | 7 | EXTERNAL SOURCES: 8 | MPOFinderFileDownloader: 9 | :path: "../../" 10 | 11 | SPEC CHECKSUMS: 12 | MPOFinderFileDownloader: 7d830d0626214b96db1ded2702a2bcd8be29a69f 13 | 14 | PODFILE CHECKSUM: c4aa15892dd9bb298764f12bfd068e4d5cd0335f 15 | 16 | COCOAPODS: 1.1.1 17 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 11DFE995BE4D0F4B8476ABC200E42EDD /* MPOFinderFileDownloadStatusUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F739465BDB7E829870DF0AD8F5D7451 /* MPOFinderFileDownloadStatusUpdater.m */; }; 11 | 227705EEAD585C3004317812C15533B8 /* MPOThroughputHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = C065C1B064971770556FD5642C5EA696 /* MPOThroughputHistory.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 3C95FE4EAFC66566A5D31F1C07208E7B /* MPOFinderFileDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 958A8F2340531C5C44C79569D23D64EF /* MPOFinderFileDownloader.m */; }; 13 | 4AAC398DC5574FD21CF375F829B29ABF /* MPOFinderFileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0CFC3C9B4F960E837D8BCDACBA85577E /* MPOFinderFileDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 73B212D595BE0A2F229915943651E9B2 /* MPOSimpleFileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 19ED5C1313CB8E703C2817A9C5499652 /* MPOSimpleFileDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15 | 778C0F77E4133ADF692FB1F785E9F0E8 /* MPOFinderFileDownloadStatusUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 167E022EA8A8D4B214BDC2F445FFD7CE /* MPOFinderFileDownloadStatusUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | B1C7DEAEB2EB5B281E88E97027F17061 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E110E3518E2D475577D0E2056C8B05D /* Foundation.framework */; }; 17 | B4A4F2B2AD40B8193ED674792FACC81E /* MPOThroughputHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = 91872D5E19A73DDFDE84426E3AF01802 /* MPOThroughputHistory.m */; }; 18 | B6C36F7BEB5C8CF7FA6CBB17CD9A54B7 /* MPOFileDownloading.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D683FA343C78C2576A5E44BA98648C0 /* MPOFileDownloading.h */; settings = {ATTRIBUTES = (Public, ); }; }; 19 | B9196BE02DC49CD2674D0DF65B137935 /* Pods-DragAndDropToDownload-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B2D421E76919D48841DD8A4FD85C578 /* Pods-DragAndDropToDownload-dummy.m */; }; 20 | BBC525BFDB87A6326AABA929878890CE /* MPOFinderFileDownloader-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = C55AF8D012F0B04766C4427229E9FB6A /* MPOFinderFileDownloader-dummy.m */; }; 21 | DDFE991D777FA75E94242677AB2C5E17 /* MPOSimpleFileDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 40F3626D09CB8593C7FA84F456DA7061 /* MPOSimpleFileDownloader.m */; }; 22 | E03D28B6B20792A81F00300ADC98FB01 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6526E38143AA3C7320583E142AA64538 /* Cocoa.framework */; }; 23 | E77D2014765A6993B9A524E3539D5F6B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6526E38143AA3C7320583E142AA64538 /* Cocoa.framework */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 7521BCEF9CD13D6F8A7DD9D0E9372B2B /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 20B9A9AA877A1CF2B07B52A3A8B0DD84; 32 | remoteInfo = MPOFinderFileDownloader; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 0CFC3C9B4F960E837D8BCDACBA85577E /* MPOFinderFileDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = MPOFinderFileDownloader.h; sourceTree = ""; }; 38 | 10B04390CD48A9B7E1F71E3FDCB885E3 /* Pods-DragAndDropToDownload.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DragAndDropToDownload.debug.xcconfig"; sourceTree = ""; }; 39 | 167E022EA8A8D4B214BDC2F445FFD7CE /* MPOFinderFileDownloadStatusUpdater.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = MPOFinderFileDownloadStatusUpdater.h; sourceTree = ""; }; 40 | 19ED5C1313CB8E703C2817A9C5499652 /* MPOSimpleFileDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = MPOSimpleFileDownloader.h; sourceTree = ""; }; 41 | 1E110E3518E2D475577D0E2056C8B05D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 42 | 28896A2E7111D1A57D87ABA1ADE44224 /* Pods-DragAndDropToDownload-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-DragAndDropToDownload-frameworks.sh"; sourceTree = ""; }; 43 | 2D683FA343C78C2576A5E44BA98648C0 /* MPOFileDownloading.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = MPOFileDownloading.h; sourceTree = ""; }; 44 | 40F3626D09CB8593C7FA84F456DA7061 /* MPOSimpleFileDownloader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = MPOSimpleFileDownloader.m; sourceTree = ""; }; 45 | 4F739465BDB7E829870DF0AD8F5D7451 /* MPOFinderFileDownloadStatusUpdater.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = MPOFinderFileDownloadStatusUpdater.m; sourceTree = ""; }; 46 | 569EE59F46A8AB9E713C997A17053BBE /* Pods-DragAndDropToDownload-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-DragAndDropToDownload-acknowledgements.markdown"; sourceTree = ""; }; 47 | 6526E38143AA3C7320583E142AA64538 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; 48 | 6CE4D4E0433A56ED81DA4EADC6578155 /* Pods-DragAndDropToDownload-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-DragAndDropToDownload-resources.sh"; sourceTree = ""; }; 49 | 7B2D421E76919D48841DD8A4FD85C578 /* Pods-DragAndDropToDownload-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-DragAndDropToDownload-dummy.m"; sourceTree = ""; }; 50 | 91872D5E19A73DDFDE84426E3AF01802 /* MPOThroughputHistory.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = MPOThroughputHistory.m; sourceTree = ""; }; 51 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 52 | 958A8F2340531C5C44C79569D23D64EF /* MPOFinderFileDownloader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = MPOFinderFileDownloader.m; sourceTree = ""; }; 53 | 9E038FF3F36E4441B7AE6C88175A9602 /* MPOFinderFileDownloader-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "MPOFinderFileDownloader-prefix.pch"; sourceTree = ""; }; 54 | BDE4D3C35A3FE4DA7E33862A1F8EA469 /* MPOFinderFileDownloader.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = MPOFinderFileDownloader.xcconfig; sourceTree = ""; }; 55 | C065C1B064971770556FD5642C5EA696 /* MPOThroughputHistory.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = MPOThroughputHistory.h; sourceTree = ""; }; 56 | C55AF8D012F0B04766C4427229E9FB6A /* MPOFinderFileDownloader-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "MPOFinderFileDownloader-dummy.m"; sourceTree = ""; }; 57 | DE4155CD856D836A7B5A1CD0C5298EFE /* Pods-DragAndDropToDownload.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DragAndDropToDownload.release.xcconfig"; sourceTree = ""; }; 58 | E48F0656DAB483F6B9C51D59517D7E0B /* libPods-DragAndDropToDownload.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = "libPods-DragAndDropToDownload.a"; path = "libPods-DragAndDropToDownload.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | ED73FEBAFC764D12095FC9BF3A02EFB5 /* libMPOFinderFileDownloader.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libMPOFinderFileDownloader.a; path = libMPOFinderFileDownloader.a; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | F9BBD71A113EB866108B76F3E5F8E812 /* Pods-DragAndDropToDownload-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-DragAndDropToDownload-acknowledgements.plist"; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 8D34268DD5FAD24DAA4CB16D59CFE94E /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | E03D28B6B20792A81F00300ADC98FB01 /* Cocoa.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | 91DFA5CC8894A2610832E33529DBA502 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | E77D2014765A6993B9A524E3539D5F6B /* Cocoa.framework in Frameworks */, 77 | B1C7DEAEB2EB5B281E88E97027F17061 /* Foundation.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 1251D82A11D77610FE4B939BE291D404 /* MPOFinderFileDownloader */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 8D067B5A0D95C2E254FA36B01513AE14 /* MPOFinderFileDownloader */, 88 | 4B2621D0575F9C3F17C3E21ABC6A511B /* Support Files */, 89 | ); 90 | name = MPOFinderFileDownloader; 91 | path = ../../..; 92 | sourceTree = ""; 93 | }; 94 | 372E9684C21B24FB24727471E7509DF5 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | ED73FEBAFC764D12095FC9BF3A02EFB5 /* libMPOFinderFileDownloader.a */, 98 | E48F0656DAB483F6B9C51D59517D7E0B /* libPods-DragAndDropToDownload.a */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 4B2621D0575F9C3F17C3E21ABC6A511B /* Support Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | BDE4D3C35A3FE4DA7E33862A1F8EA469 /* MPOFinderFileDownloader.xcconfig */, 107 | C55AF8D012F0B04766C4427229E9FB6A /* MPOFinderFileDownloader-dummy.m */, 108 | 9E038FF3F36E4441B7AE6C88175A9602 /* MPOFinderFileDownloader-prefix.pch */, 109 | ); 110 | name = "Support Files"; 111 | path = "Examples/DragAndDropToDownload/Pods/Target Support Files/MPOFinderFileDownloader"; 112 | sourceTree = ""; 113 | }; 114 | 7B096A475BBB7BA9C78CBE4AAB74B014 /* Development Pods */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 1251D82A11D77610FE4B939BE291D404 /* MPOFinderFileDownloader */, 118 | ); 119 | name = "Development Pods"; 120 | sourceTree = ""; 121 | }; 122 | 7DB346D0F39D3F0E887471402A8071AB = { 123 | isa = PBXGroup; 124 | children = ( 125 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, 126 | 7B096A475BBB7BA9C78CBE4AAB74B014 /* Development Pods */, 127 | D648CE86F139C7CCFD55D5B8A03BE74B /* Frameworks */, 128 | 372E9684C21B24FB24727471E7509DF5 /* Products */, 129 | 9D9303AAFF3A6085AA1D1676E35AF0C7 /* Targets Support Files */, 130 | ); 131 | sourceTree = ""; 132 | }; 133 | 8D067B5A0D95C2E254FA36B01513AE14 /* MPOFinderFileDownloader */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 2D683FA343C78C2576A5E44BA98648C0 /* MPOFileDownloading.h */, 137 | 0CFC3C9B4F960E837D8BCDACBA85577E /* MPOFinderFileDownloader.h */, 138 | 958A8F2340531C5C44C79569D23D64EF /* MPOFinderFileDownloader.m */, 139 | 167E022EA8A8D4B214BDC2F445FFD7CE /* MPOFinderFileDownloadStatusUpdater.h */, 140 | 4F739465BDB7E829870DF0AD8F5D7451 /* MPOFinderFileDownloadStatusUpdater.m */, 141 | 19ED5C1313CB8E703C2817A9C5499652 /* MPOSimpleFileDownloader.h */, 142 | 40F3626D09CB8593C7FA84F456DA7061 /* MPOSimpleFileDownloader.m */, 143 | C065C1B064971770556FD5642C5EA696 /* MPOThroughputHistory.h */, 144 | 91872D5E19A73DDFDE84426E3AF01802 /* MPOThroughputHistory.m */, 145 | ); 146 | name = MPOFinderFileDownloader; 147 | path = MPOFinderFileDownloader; 148 | sourceTree = ""; 149 | }; 150 | 92FC4590B3B6C6A2141FDC7D1DA8879E /* OS X */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 6526E38143AA3C7320583E142AA64538 /* Cocoa.framework */, 154 | 1E110E3518E2D475577D0E2056C8B05D /* Foundation.framework */, 155 | ); 156 | name = "OS X"; 157 | sourceTree = ""; 158 | }; 159 | 9D9303AAFF3A6085AA1D1676E35AF0C7 /* Targets Support Files */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | E1A0884C3E71E2C131F7144389BBBC3D /* Pods-DragAndDropToDownload */, 163 | ); 164 | name = "Targets Support Files"; 165 | sourceTree = ""; 166 | }; 167 | D648CE86F139C7CCFD55D5B8A03BE74B /* Frameworks */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 92FC4590B3B6C6A2141FDC7D1DA8879E /* OS X */, 171 | ); 172 | name = Frameworks; 173 | sourceTree = ""; 174 | }; 175 | E1A0884C3E71E2C131F7144389BBBC3D /* Pods-DragAndDropToDownload */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 569EE59F46A8AB9E713C997A17053BBE /* Pods-DragAndDropToDownload-acknowledgements.markdown */, 179 | F9BBD71A113EB866108B76F3E5F8E812 /* Pods-DragAndDropToDownload-acknowledgements.plist */, 180 | 7B2D421E76919D48841DD8A4FD85C578 /* Pods-DragAndDropToDownload-dummy.m */, 181 | 28896A2E7111D1A57D87ABA1ADE44224 /* Pods-DragAndDropToDownload-frameworks.sh */, 182 | 6CE4D4E0433A56ED81DA4EADC6578155 /* Pods-DragAndDropToDownload-resources.sh */, 183 | 10B04390CD48A9B7E1F71E3FDCB885E3 /* Pods-DragAndDropToDownload.debug.xcconfig */, 184 | DE4155CD856D836A7B5A1CD0C5298EFE /* Pods-DragAndDropToDownload.release.xcconfig */, 185 | ); 186 | name = "Pods-DragAndDropToDownload"; 187 | path = "Target Support Files/Pods-DragAndDropToDownload"; 188 | sourceTree = ""; 189 | }; 190 | /* End PBXGroup section */ 191 | 192 | /* Begin PBXHeadersBuildPhase section */ 193 | DBDDA88B1C0F21EC900DC233881D9B41 /* Headers */ = { 194 | isa = PBXHeadersBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | B6C36F7BEB5C8CF7FA6CBB17CD9A54B7 /* MPOFileDownloading.h in Headers */, 198 | 4AAC398DC5574FD21CF375F829B29ABF /* MPOFinderFileDownloader.h in Headers */, 199 | 778C0F77E4133ADF692FB1F785E9F0E8 /* MPOFinderFileDownloadStatusUpdater.h in Headers */, 200 | 73B212D595BE0A2F229915943651E9B2 /* MPOSimpleFileDownloader.h in Headers */, 201 | 227705EEAD585C3004317812C15533B8 /* MPOThroughputHistory.h in Headers */, 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | }; 205 | /* End PBXHeadersBuildPhase section */ 206 | 207 | /* Begin PBXNativeTarget section */ 208 | 20B9A9AA877A1CF2B07B52A3A8B0DD84 /* MPOFinderFileDownloader */ = { 209 | isa = PBXNativeTarget; 210 | buildConfigurationList = 17278CE8C98751C45B7AC5B2F2BAA848 /* Build configuration list for PBXNativeTarget "MPOFinderFileDownloader" */; 211 | buildPhases = ( 212 | B53238A35587C118923CB155F57B3200 /* Sources */, 213 | 91DFA5CC8894A2610832E33529DBA502 /* Frameworks */, 214 | DBDDA88B1C0F21EC900DC233881D9B41 /* Headers */, 215 | ); 216 | buildRules = ( 217 | ); 218 | dependencies = ( 219 | ); 220 | name = MPOFinderFileDownloader; 221 | productName = MPOFinderFileDownloader; 222 | productReference = ED73FEBAFC764D12095FC9BF3A02EFB5 /* libMPOFinderFileDownloader.a */; 223 | productType = "com.apple.product-type.library.static"; 224 | }; 225 | 78BBFAEFE95777B68CD79603512ACA32 /* Pods-DragAndDropToDownload */ = { 226 | isa = PBXNativeTarget; 227 | buildConfigurationList = B58EBF46AA77FDE5943EB0C3A3F0646D /* Build configuration list for PBXNativeTarget "Pods-DragAndDropToDownload" */; 228 | buildPhases = ( 229 | 1801BF56E272B96C3E982ECCAEF6A734 /* Sources */, 230 | 8D34268DD5FAD24DAA4CB16D59CFE94E /* Frameworks */, 231 | ); 232 | buildRules = ( 233 | ); 234 | dependencies = ( 235 | 62D9621E6A7D421AE139A17C46E7B5A8 /* PBXTargetDependency */, 236 | ); 237 | name = "Pods-DragAndDropToDownload"; 238 | productName = "Pods-DragAndDropToDownload"; 239 | productReference = E48F0656DAB483F6B9C51D59517D7E0B /* libPods-DragAndDropToDownload.a */; 240 | productType = "com.apple.product-type.library.static"; 241 | }; 242 | /* End PBXNativeTarget section */ 243 | 244 | /* Begin PBXProject section */ 245 | D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { 246 | isa = PBXProject; 247 | attributes = { 248 | LastSwiftUpdateCheck = 0730; 249 | LastUpgradeCheck = 0700; 250 | }; 251 | buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; 252 | compatibilityVersion = "Xcode 3.2"; 253 | developmentRegion = English; 254 | hasScannedForEncodings = 0; 255 | knownRegions = ( 256 | en, 257 | ); 258 | mainGroup = 7DB346D0F39D3F0E887471402A8071AB; 259 | productRefGroup = 372E9684C21B24FB24727471E7509DF5 /* Products */; 260 | projectDirPath = ""; 261 | projectRoot = ""; 262 | targets = ( 263 | 20B9A9AA877A1CF2B07B52A3A8B0DD84 /* MPOFinderFileDownloader */, 264 | 78BBFAEFE95777B68CD79603512ACA32 /* Pods-DragAndDropToDownload */, 265 | ); 266 | }; 267 | /* End PBXProject section */ 268 | 269 | /* Begin PBXSourcesBuildPhase section */ 270 | 1801BF56E272B96C3E982ECCAEF6A734 /* Sources */ = { 271 | isa = PBXSourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | B9196BE02DC49CD2674D0DF65B137935 /* Pods-DragAndDropToDownload-dummy.m in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | B53238A35587C118923CB155F57B3200 /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | BBC525BFDB87A6326AABA929878890CE /* MPOFinderFileDownloader-dummy.m in Sources */, 283 | 3C95FE4EAFC66566A5D31F1C07208E7B /* MPOFinderFileDownloader.m in Sources */, 284 | 11DFE995BE4D0F4B8476ABC200E42EDD /* MPOFinderFileDownloadStatusUpdater.m in Sources */, 285 | DDFE991D777FA75E94242677AB2C5E17 /* MPOSimpleFileDownloader.m in Sources */, 286 | B4A4F2B2AD40B8193ED674792FACC81E /* MPOThroughputHistory.m in Sources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | /* End PBXSourcesBuildPhase section */ 291 | 292 | /* Begin PBXTargetDependency section */ 293 | 62D9621E6A7D421AE139A17C46E7B5A8 /* PBXTargetDependency */ = { 294 | isa = PBXTargetDependency; 295 | name = MPOFinderFileDownloader; 296 | target = 20B9A9AA877A1CF2B07B52A3A8B0DD84 /* MPOFinderFileDownloader */; 297 | targetProxy = 7521BCEF9CD13D6F8A7DD9D0E9372B2B /* PBXContainerItemProxy */; 298 | }; 299 | /* End PBXTargetDependency section */ 300 | 301 | /* Begin XCBuildConfiguration section */ 302 | 0D817B6F0F412DF1B54956FCC5B5A1CE /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | baseConfigurationReference = BDE4D3C35A3FE4DA7E33862A1F8EA469 /* MPOFinderFileDownloader.xcconfig */; 305 | buildSettings = { 306 | CODE_SIGN_IDENTITY = "-"; 307 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 308 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 309 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 310 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 311 | ENABLE_STRICT_OBJC_MSGSEND = YES; 312 | EXECUTABLE_PREFIX = lib; 313 | GCC_NO_COMMON_BLOCKS = YES; 314 | GCC_PREFIX_HEADER = "Target Support Files/MPOFinderFileDownloader/MPOFinderFileDownloader-prefix.pch"; 315 | MACOSX_DEPLOYMENT_TARGET = 10.9; 316 | MTL_ENABLE_DEBUG_INFO = NO; 317 | OTHER_LDFLAGS = ""; 318 | OTHER_LIBTOOLFLAGS = ""; 319 | PRIVATE_HEADERS_FOLDER_PATH = ""; 320 | PRODUCT_NAME = "$(TARGET_NAME)"; 321 | PUBLIC_HEADERS_FOLDER_PATH = ""; 322 | SDKROOT = macosx; 323 | }; 324 | name = Release; 325 | }; 326 | 1C0088F463CCD63294D60EB7A646D917 /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | baseConfigurationReference = DE4155CD856D836A7B5A1CD0C5298EFE /* Pods-DragAndDropToDownload.release.xcconfig */; 329 | buildSettings = { 330 | CODE_SIGN_IDENTITY = "-"; 331 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 332 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 333 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 334 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | EXECUTABLE_PREFIX = lib; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | MACH_O_TYPE = staticlib; 339 | MACOSX_DEPLOYMENT_TARGET = 10.12; 340 | MTL_ENABLE_DEBUG_INFO = NO; 341 | OTHER_LDFLAGS = ""; 342 | OTHER_LIBTOOLFLAGS = ""; 343 | PODS_ROOT = "$(SRCROOT)"; 344 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | SDKROOT = macosx; 347 | SKIP_INSTALL = YES; 348 | }; 349 | name = Release; 350 | }; 351 | 34342BBF37D3A9ED85FF2EB654934920 /* Debug */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | ALWAYS_SEARCH_USER_PATHS = NO; 355 | CLANG_ANALYZER_NONNULL = YES; 356 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 357 | CLANG_CXX_LIBRARY = "libc++"; 358 | CLANG_ENABLE_MODULES = YES; 359 | CLANG_ENABLE_OBJC_ARC = YES; 360 | CLANG_WARN_BOOL_CONVERSION = YES; 361 | CLANG_WARN_CONSTANT_CONVERSION = YES; 362 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 363 | CLANG_WARN_EMPTY_BODY = YES; 364 | CLANG_WARN_ENUM_CONVERSION = YES; 365 | CLANG_WARN_INT_CONVERSION = YES; 366 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 367 | CLANG_WARN_UNREACHABLE_CODE = YES; 368 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 369 | CODE_SIGNING_REQUIRED = NO; 370 | COPY_PHASE_STRIP = NO; 371 | ENABLE_TESTABILITY = YES; 372 | GCC_C_LANGUAGE_STANDARD = gnu99; 373 | GCC_DYNAMIC_NO_PIC = NO; 374 | GCC_OPTIMIZATION_LEVEL = 0; 375 | GCC_PREPROCESSOR_DEFINITIONS = ( 376 | "POD_CONFIGURATION_DEBUG=1", 377 | "DEBUG=1", 378 | "$(inherited)", 379 | ); 380 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 381 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 382 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 383 | GCC_WARN_UNDECLARED_SELECTOR = YES; 384 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 385 | GCC_WARN_UNUSED_FUNCTION = YES; 386 | GCC_WARN_UNUSED_VARIABLE = YES; 387 | MACOSX_DEPLOYMENT_TARGET = 10.12; 388 | ONLY_ACTIVE_ARCH = YES; 389 | PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; 390 | STRIP_INSTALLED_PRODUCT = NO; 391 | SYMROOT = "${SRCROOT}/../build"; 392 | }; 393 | name = Debug; 394 | }; 395 | A404E9EA167811FB09EDFB6AACF7BD4E /* Debug */ = { 396 | isa = XCBuildConfiguration; 397 | baseConfigurationReference = 10B04390CD48A9B7E1F71E3FDCB885E3 /* Pods-DragAndDropToDownload.debug.xcconfig */; 398 | buildSettings = { 399 | CODE_SIGN_IDENTITY = "-"; 400 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 401 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 402 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 403 | DEBUG_INFORMATION_FORMAT = dwarf; 404 | ENABLE_STRICT_OBJC_MSGSEND = YES; 405 | EXECUTABLE_PREFIX = lib; 406 | GCC_NO_COMMON_BLOCKS = YES; 407 | MACH_O_TYPE = staticlib; 408 | MACOSX_DEPLOYMENT_TARGET = 10.12; 409 | MTL_ENABLE_DEBUG_INFO = YES; 410 | OTHER_LDFLAGS = ""; 411 | OTHER_LIBTOOLFLAGS = ""; 412 | PODS_ROOT = "$(SRCROOT)"; 413 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | SDKROOT = macosx; 416 | SKIP_INSTALL = YES; 417 | }; 418 | name = Debug; 419 | }; 420 | E29AFA3D6A62722CC155A4F0C758D4DC /* Debug */ = { 421 | isa = XCBuildConfiguration; 422 | baseConfigurationReference = BDE4D3C35A3FE4DA7E33862A1F8EA469 /* MPOFinderFileDownloader.xcconfig */; 423 | buildSettings = { 424 | CODE_SIGN_IDENTITY = "-"; 425 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 426 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 427 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 428 | DEBUG_INFORMATION_FORMAT = dwarf; 429 | ENABLE_STRICT_OBJC_MSGSEND = YES; 430 | EXECUTABLE_PREFIX = lib; 431 | GCC_NO_COMMON_BLOCKS = YES; 432 | GCC_PREFIX_HEADER = "Target Support Files/MPOFinderFileDownloader/MPOFinderFileDownloader-prefix.pch"; 433 | MACOSX_DEPLOYMENT_TARGET = 10.9; 434 | MTL_ENABLE_DEBUG_INFO = YES; 435 | OTHER_LDFLAGS = ""; 436 | OTHER_LIBTOOLFLAGS = ""; 437 | PRIVATE_HEADERS_FOLDER_PATH = ""; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | PUBLIC_HEADERS_FOLDER_PATH = ""; 440 | SDKROOT = macosx; 441 | }; 442 | name = Debug; 443 | }; 444 | F6FC88CB717F413199C282718D2DC09F /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ALWAYS_SEARCH_USER_PATHS = NO; 448 | CLANG_ANALYZER_NONNULL = YES; 449 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 450 | CLANG_CXX_LIBRARY = "libc++"; 451 | CLANG_ENABLE_MODULES = YES; 452 | CLANG_ENABLE_OBJC_ARC = YES; 453 | CLANG_WARN_BOOL_CONVERSION = YES; 454 | CLANG_WARN_CONSTANT_CONVERSION = YES; 455 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 456 | CLANG_WARN_EMPTY_BODY = YES; 457 | CLANG_WARN_ENUM_CONVERSION = YES; 458 | CLANG_WARN_INT_CONVERSION = YES; 459 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 460 | CLANG_WARN_UNREACHABLE_CODE = YES; 461 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 462 | CODE_SIGNING_REQUIRED = NO; 463 | COPY_PHASE_STRIP = YES; 464 | ENABLE_NS_ASSERTIONS = NO; 465 | GCC_C_LANGUAGE_STANDARD = gnu99; 466 | GCC_PREPROCESSOR_DEFINITIONS = ( 467 | "POD_CONFIGURATION_RELEASE=1", 468 | "$(inherited)", 469 | ); 470 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 471 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 472 | GCC_WARN_UNDECLARED_SELECTOR = YES; 473 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 474 | GCC_WARN_UNUSED_FUNCTION = YES; 475 | GCC_WARN_UNUSED_VARIABLE = YES; 476 | MACOSX_DEPLOYMENT_TARGET = 10.12; 477 | PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; 478 | STRIP_INSTALLED_PRODUCT = NO; 479 | SYMROOT = "${SRCROOT}/../build"; 480 | VALIDATE_PRODUCT = YES; 481 | }; 482 | name = Release; 483 | }; 484 | /* End XCBuildConfiguration section */ 485 | 486 | /* Begin XCConfigurationList section */ 487 | 17278CE8C98751C45B7AC5B2F2BAA848 /* Build configuration list for PBXNativeTarget "MPOFinderFileDownloader" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | E29AFA3D6A62722CC155A4F0C758D4DC /* Debug */, 491 | 0D817B6F0F412DF1B54956FCC5B5A1CE /* Release */, 492 | ); 493 | defaultConfigurationIsVisible = 0; 494 | defaultConfigurationName = Release; 495 | }; 496 | 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { 497 | isa = XCConfigurationList; 498 | buildConfigurations = ( 499 | 34342BBF37D3A9ED85FF2EB654934920 /* Debug */, 500 | F6FC88CB717F413199C282718D2DC09F /* Release */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | B58EBF46AA77FDE5943EB0C3A3F0646D /* Build configuration list for PBXNativeTarget "Pods-DragAndDropToDownload" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | A404E9EA167811FB09EDFB6AACF7BD4E /* Debug */, 509 | 1C0088F463CCD63294D60EB7A646D917 /* Release */, 510 | ); 511 | defaultConfigurationIsVisible = 0; 512 | defaultConfigurationName = Release; 513 | }; 514 | /* End XCConfigurationList section */ 515 | }; 516 | rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 517 | } 518 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/MPOFinderFileDownloader/MPOFinderFileDownloader-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_MPOFinderFileDownloader : NSObject 3 | @end 4 | @implementation PodsDummy_MPOFinderFileDownloader 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/MPOFinderFileDownloader/MPOFinderFileDownloader-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/MPOFinderFileDownloader/MPOFinderFileDownloader.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/MPOFinderFileDownloader 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MPOFinderFileDownloader" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MPOFinderFileDownloader" 4 | OTHER_LDFLAGS = -framework "Foundation" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## MPOFinderFileDownloader 5 | 6 | MIT License 7 | 8 | Copyright (c) 2018 wutian 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | Generated by CocoaPods - https://cocoapods.org 28 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | MIT License 18 | 19 | Copyright (c) 2018 wutian 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | License 39 | Apache 2.0 40 | Title 41 | MPOFinderFileDownloader 42 | Type 43 | PSGroupSpecifier 44 | 45 | 46 | FooterText 47 | Generated by CocoaPods - https://cocoapods.org 48 | Title 49 | 50 | Type 51 | PSGroupSpecifier 52 | 53 | 54 | StringsTable 55 | Acknowledgements 56 | Title 57 | Acknowledgements 58 | 59 | 60 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_DragAndDropToDownload : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_DragAndDropToDownload 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" 63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" 64 | fi 65 | } 66 | 67 | # Strip invalid architectures 68 | strip_invalid_archs() { 69 | binary="$1" 70 | # Get architectures for current file 71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 72 | stripped="" 73 | for arch in $archs; do 74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 75 | # Strip non-valid architectures in-place 76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 77 | stripped="$stripped $arch" 78 | fi 79 | done 80 | if [[ "$stripped" ]]; then 81 | echo "Stripped $binary of architectures:$stripped" 82 | fi 83 | } 84 | 85 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | *) 22 | TARGET_DEVICE_ARGS="--target-device mac" 23 | ;; 24 | esac 25 | 26 | install_resource() 27 | { 28 | if [[ "$1" = /* ]] ; then 29 | RESOURCE_PATH="$1" 30 | else 31 | RESOURCE_PATH="${PODS_ROOT}/$1" 32 | fi 33 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 34 | cat << EOM 35 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 36 | EOM 37 | exit 1 38 | fi 39 | case $RESOURCE_PATH in 40 | *.storyboard) 41 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 42 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 43 | ;; 44 | *.xib) 45 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 46 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 47 | ;; 48 | *.framework) 49 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 50 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 51 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 52 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | ;; 54 | *.xcdatamodel) 55 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 56 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 57 | ;; 58 | *.xcdatamodeld) 59 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 60 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 61 | ;; 62 | *.xcmappingmodel) 63 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 64 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 65 | ;; 66 | *.xcassets) 67 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 68 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 69 | ;; 70 | *) 71 | echo "$RESOURCE_PATH" 72 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 73 | ;; 74 | esac 75 | } 76 | 77 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 78 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 79 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 80 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 81 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 82 | fi 83 | rm -f "$RESOURCES_TO_COPY" 84 | 85 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 86 | then 87 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 88 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 89 | while read line; do 90 | if [[ $line != "${PODS_ROOT}*" ]]; then 91 | XCASSET_FILES+=("$line") 92 | fi 93 | done <<<"$OTHER_XCASSETS" 94 | 95 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | fi 97 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MPOFinderFileDownloader" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/MPOFinderFileDownloader" 5 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/MPOFinderFileDownloader" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"MPOFinderFileDownloader" -framework "Foundation" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Examples/DragAndDropToDownload/Pods/Target Support Files/Pods-DragAndDropToDownload/Pods-DragAndDropToDownload.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MPOFinderFileDownloader" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/MPOFinderFileDownloader" 5 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/MPOFinderFileDownloader" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"MPOFinderFileDownloader" -framework "Foundation" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 wutian 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /MPOFinderFileDownloader.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "MPOFinderFileDownloader" 5 | s.version = "0.0.1" 6 | s.authors = ["Naituw"] 7 | s.summary = "A simple file downloader adds progress indicator to finder when downloading" 8 | s.homepage = "https://github.com/Naituw/MPOFinderFileDownloader" 9 | s.license = "Apache 2.0" 10 | s.source = { :git => "https://github.com/Naituw/MPOFinderFileDownloader.git", :tag => "v0.0.1" } 11 | s.requires_arc = true 12 | s.frameworks = 'Foundation' 13 | s.platforms = { :osx => "10.9" } 14 | s.source_files = 'MPOFinderFileDownloader/*.{h,m}' 15 | 16 | end -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOFileDownloading.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOFileDownloading.h 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // 7 | 8 | #import 9 | 10 | typedef void (^MPOFileDownloadProgressBlock)(long long bytesWritten, long long totalBytesExpected); 11 | typedef void (^MPOFileDownloadCompletionBlock)(NSError * error); 12 | 13 | // MPOFileDownloader should NOT support more than one download task per instance 14 | 15 | @protocol MPOFileDownloading 16 | 17 | - (void)downloadURL:(NSURL *)url toPath:(NSString *)path progress:(MPOFileDownloadProgressBlock)progress completion:(MPOFileDownloadCompletionBlock)completion; 18 | 19 | @property (nonatomic, assign, readonly) BOOL downloading; 20 | 21 | - (void)cancelCurrentDownload; 22 | 23 | @property (nonatomic, assign, readonly) long long currentDownloadSpeedBytesPerSecond; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOFinderFileDownloadStatusUpdater.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOFinderFileStatusUpdater.h 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol MPOFinderFileDownloadStatusUpdaterDelegate; 12 | 13 | @interface MPOFinderFileDownloadStatusUpdater : NSObject 14 | 15 | - (instancetype)initWithDownloadingToFilePath:(NSString *)path sourceURL:(NSURL *)sourceURL delegate:(id)delegate; 16 | 17 | - (void)downloadProgressUpdateWithTotalBytesExpected:(long long)totalBytes bytesWritten:(long long)bytesWritten speed:(long long)speedBytesPerSecond; 18 | - (void)downloadFinished; 19 | 20 | @end 21 | 22 | @protocol MPOFinderFileDownloadStatusUpdaterDelegate 23 | 24 | - (void)fileDownloadStatusUpdaterDidPerformCancel:(MPOFinderFileDownloadStatusUpdater *)updater; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOFinderFileDownloadStatusUpdater.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPOFinderFileStatusUpdater.m 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | // Most of logic in this file derived from chromium project 10 | // https://github.com/scheib/chromium/blob/master/chrome/browser/download/download_status_updater_mac.mm 11 | 12 | #import "MPOFinderFileDownloadStatusUpdater.h" 13 | 14 | // Given an NSProgress string name (kNSProgress[...]Name above), looks up the 15 | // real symbol of that name from Foundation and returns it. 16 | static NSString* ProgressString(NSString* string) { 17 | static NSMutableDictionary* cache; 18 | static CFBundleRef foundation; 19 | if (!cache) { 20 | cache = [[NSMutableDictionary alloc] init]; 21 | foundation = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.Foundation")); 22 | } 23 | 24 | NSString* result = [cache objectForKey:string]; 25 | if (!result) { 26 | NSString * __strong * ref = (NSString * __strong *)CFBundleGetDataPointerForName(foundation, (CFStringRef)string); 27 | if (ref) { 28 | result = *ref; 29 | [cache setObject:result forKey:string]; 30 | } 31 | } 32 | 33 | if (!result) { 34 | // Huh. At least return a local copy of the expected string. 35 | result = string; 36 | NSString* const kKeySuffix = @"Key"; 37 | if ([result hasSuffix:kKeySuffix]) 38 | result = [result substringToIndex:[result length] - [kKeySuffix length]]; 39 | } 40 | 41 | return result; 42 | } 43 | 44 | @interface MPOFinderFileDownloadStatusUpdater () 45 | { 46 | struct { 47 | unsigned int downloadStarted: 1; 48 | unsigned int downloadFinished: 1; 49 | } _flags; 50 | } 51 | 52 | @property (nonatomic, assign) long long totalBytesExpected; 53 | @property (nonatomic, assign) long long bytesWritten; 54 | @property (nonatomic, assign) long long speedBytesPerSecond; 55 | 56 | @property (nonatomic, strong) NSProgress * nsProgress; 57 | @property (nonatomic, strong) NSString * filePath; 58 | @property (nonatomic, strong) NSURL * sourceDownloadURL; 59 | @property (nonatomic, weak) id delegate; 60 | 61 | @end 62 | 63 | @implementation MPOFinderFileDownloadStatusUpdater 64 | 65 | - (void)dealloc 66 | { 67 | [self _destoryNSProgress]; 68 | } 69 | 70 | - (instancetype)initWithDownloadingToFilePath:(NSString *)path sourceURL:(NSURL *)sourceURL delegate:(id)delegate 71 | { 72 | if (self = [super init]) { 73 | _filePath = path; 74 | _sourceDownloadURL = sourceURL; 75 | _delegate = delegate; 76 | 77 | if (!_filePath.length) { 78 | return nil; 79 | } 80 | 81 | if ([[NSFileManager defaultManager] fileExistsAtPath:_filePath]) { 82 | _nsProgress = [self _createNSProgress]; 83 | } 84 | } 85 | return self; 86 | } 87 | 88 | - (void)downloadProgressUpdateWithTotalBytesExpected:(long long)totalBytes bytesWritten:(long long)bytesWritten speed:(long long)speedBytesPerSecond 89 | { 90 | _totalBytesExpected = totalBytes; 91 | _bytesWritten = bytesWritten; 92 | _speedBytesPerSecond = speedBytesPerSecond; 93 | 94 | if (!_nsProgress) { 95 | _nsProgress = [self _createNSProgress]; 96 | } else { 97 | [self _updateNSProgress]; 98 | } 99 | } 100 | 101 | - (void)downloadFinished 102 | { 103 | [self _destoryNSProgress]; 104 | 105 | if ([[NSFileManager defaultManager] fileExistsAtPath:self.filePath]) { 106 | // Bounce the dock icon. 107 | [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.DownloadFileFinished" object:self.filePath]; 108 | 109 | // Notify the Finder. 110 | [[NSWorkspace sharedWorkspace] noteFileSystemChanged:self.filePath]; 111 | } 112 | } 113 | 114 | - (void)_destoryNSProgress 115 | { 116 | if (_nsProgress) { 117 | [_nsProgress unpublish]; 118 | _nsProgress = nil; 119 | } 120 | } 121 | 122 | - (NSProgress *)_createNSProgress 123 | { 124 | NSURL * destinationURL = [NSURL fileURLWithPath:self.filePath]; 125 | 126 | if (!destinationURL) { 127 | return nil; 128 | } 129 | 130 | NSDictionary * userInfo = @{ProgressString([NSString stringWithFormat:@"%@%@", @"NSProgressFile", @"LocationCanChangeKey"]): @true, 131 | NSProgressFileOperationKindKey: NSProgressFileOperationKindDownloading, 132 | NSProgressFileURLKey: destinationURL}; 133 | 134 | NSProgress * progress = [[NSProgress alloc] initWithParent:nil userInfo:userInfo]; 135 | progress.kind = NSProgressKindFile; 136 | 137 | if (_sourceDownloadURL) { 138 | [progress setUserInfoObject:_sourceDownloadURL forKey:ProgressString([NSString stringWithFormat:@"%@%@", @"NSProgressFile", @"DownloadingSourceURLKey"])]; 139 | } 140 | 141 | progress.pausable = NO; 142 | progress.cancellable = YES; 143 | 144 | typeof(self) __weak this = self; 145 | 146 | [progress setCancellationHandler:^{ 147 | dispatch_async(dispatch_get_main_queue(), ^{ 148 | [this _performCancel]; 149 | }); 150 | }]; 151 | 152 | if (_totalBytesExpected) { 153 | progress.totalUnitCount = _totalBytesExpected; 154 | progress.completedUnitCount = _bytesWritten; 155 | } 156 | 157 | [progress publish]; 158 | 159 | return progress; 160 | } 161 | 162 | - (void)_updateNSProgress 163 | { 164 | _nsProgress.totalUnitCount = _totalBytesExpected; 165 | _nsProgress.completedUnitCount = _bytesWritten; 166 | 167 | if (_speedBytesPerSecond >= 0) { 168 | [_nsProgress setUserInfoObject:@(_speedBytesPerSecond) forKey:NSProgressThroughputKey]; 169 | 170 | if (_speedBytesPerSecond > 0) { 171 | long long bytesRemaining = MAX(0, _totalBytesExpected - _bytesWritten); 172 | NSTimeInterval timeRemaining = (double)bytesRemaining / _speedBytesPerSecond; 173 | [_nsProgress setUserInfoObject:@(timeRemaining) forKey:NSProgressEstimatedTimeRemainingKey]; 174 | } else { 175 | [_nsProgress setUserInfoObject:nil forKey:NSProgressEstimatedTimeRemainingKey]; 176 | } 177 | } else { 178 | [_nsProgress setUserInfoObject:nil forKey:NSProgressThroughputKey]; 179 | [_nsProgress setUserInfoObject:nil forKey:NSProgressEstimatedTimeRemainingKey]; 180 | } 181 | } 182 | 183 | - (void)_performCancel 184 | { 185 | if ([_delegate respondsToSelector:@selector(fileDownloadStatusUpdaterDidPerformCancel:)]) { 186 | [_delegate fileDownloadStatusUpdaterDidPerformCancel:self]; 187 | } 188 | } 189 | 190 | @end 191 | -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOFinderFileDownloader.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOFinderFileDownloader.h 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MPOFileDownloading.h" 11 | 12 | @interface MPOFinderFileDownloader : NSObject 13 | 14 | - (instancetype)initWithUnderlyingDownloader:(id)downloader; 15 | 16 | @property (nonatomic, strong, readonly) id underlyingDownloader; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOFinderFileDownloader.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPOFinderFileDownloader.m 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import "MPOFinderFileDownloader.h" 10 | #import "MPOFinderFileDownloadStatusUpdater.h" 11 | 12 | @interface MPOFinderFileDownloader () 13 | 14 | @property (nonatomic, strong) id underlyingDownloader; 15 | @property (nonatomic, strong) MPOFinderFileDownloadStatusUpdater * fileStatusUpdater; 16 | 17 | @end 18 | 19 | @implementation MPOFinderFileDownloader 20 | 21 | - (instancetype)initWithUnderlyingDownloader:(id)downloader 22 | { 23 | if (self = [self init]) { 24 | self.underlyingDownloader = downloader; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)downloadURL:(NSURL *)url toPath:(NSString *)path progress:(MPOFileDownloadProgressBlock)progressBlock completion:(MPOFileDownloadCompletionBlock)completion 30 | { 31 | BOOL __block finished = NO; 32 | typeof(self) __weak weakSelf = self; 33 | [self.underlyingDownloader downloadURL:url toPath:path progress:^(long long bytesWritten, long long totalBytesExpected) { 34 | typeof(weakSelf) __strong strongSelf = weakSelf; 35 | if (!strongSelf) { 36 | return; 37 | } 38 | 39 | [strongSelf.fileStatusUpdater downloadProgressUpdateWithTotalBytesExpected:totalBytesExpected bytesWritten:bytesWritten speed:strongSelf.underlyingDownloader.currentDownloadSpeedBytesPerSecond]; 40 | 41 | if (progressBlock) { 42 | progressBlock(bytesWritten, totalBytesExpected); 43 | } 44 | } completion:^(NSError *error) { 45 | finished = YES; 46 | typeof(weakSelf) __strong strongSelf = weakSelf; 47 | if (!strongSelf) { 48 | return; 49 | } 50 | 51 | if (strongSelf.fileStatusUpdater) { 52 | [strongSelf.fileStatusUpdater downloadFinished]; 53 | [strongSelf setFileStatusUpdater:nil]; 54 | } 55 | 56 | if (completion) { 57 | completion(error); 58 | } 59 | }]; 60 | 61 | if (!finished) { 62 | self.fileStatusUpdater = [[MPOFinderFileDownloadStatusUpdater alloc] initWithDownloadingToFilePath:path sourceURL:url delegate:self]; 63 | } 64 | } 65 | 66 | - (BOOL)downloading 67 | { 68 | return self.underlyingDownloader.downloading; 69 | } 70 | 71 | - (void)cancelCurrentDownload 72 | { 73 | [self.underlyingDownloader cancelCurrentDownload]; 74 | } 75 | 76 | - (long long)currentDownloadSpeedBytesPerSecond 77 | { 78 | return self.underlyingDownloader.currentDownloadSpeedBytesPerSecond; 79 | } 80 | 81 | - (void)fileDownloadStatusUpdaterDidPerformCancel:(MPOFinderFileDownloadStatusUpdater *)updater 82 | { 83 | [self cancelCurrentDownload]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOSimpleFileDownloader.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOSimpleDownloader.h 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MPOFileDownloading.h" 11 | 12 | @interface MPOSimpleFileDownloader : NSObject 13 | 14 | @end 15 | 16 | typedef NS_ENUM(NSInteger, MPOSimpleFileDownloaderErrorCode) { 17 | MPOSimpleFileDownloaderErrorCodeUnknown = 0, 18 | MPOSimpleFileDownloaderErrorCodeAlreadyDownloading, 19 | MPOSimpleFileDownloaderErrorCodeFileExists, 20 | MPOSimpleFileDownloaderErrorCodeInvalidParamaters, 21 | MPOSimpleFileDownloaderErrorCodeUnexpectedEOF, 22 | MPOSimpleFileDownloaderErrorCodeCancelled, 23 | }; 24 | 25 | extern NSString * const MPOSimpleFileDownloaderErrorDomain; 26 | -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOSimpleFileDownloader.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPOSimpleDownloader.m 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/10. 6 | // Copyright © 2018年 wutian. All rights reserved. 7 | // 8 | 9 | #import "MPOSimpleFileDownloader.h" 10 | #import "MPOThroughputHistory.h" 11 | 12 | @interface MPOSimpleFileDownloader () 13 | 14 | @property (nonatomic, strong) NSURLConnection * currentConnection; 15 | @property (nonatomic, strong) MPOThroughputHistory * throughputHistory; 16 | @property (nonatomic, strong) NSOutputStream * fileOutputStream; 17 | @property (nonatomic, strong) NSString * outputPath; 18 | @property (nonatomic, copy) MPOFileDownloadProgressBlock progressBlock; 19 | @property (nonatomic, copy) MPOFileDownloadCompletionBlock completionBlock; 20 | @property (nonatomic, assign) long long fileTotalBytes; 21 | @property (nonatomic, assign) long long fileBytesWritten; 22 | 23 | @end 24 | 25 | @implementation MPOSimpleFileDownloader 26 | 27 | - (instancetype)init 28 | { 29 | if (self = [super init]) { 30 | [self _reset]; 31 | } 32 | return self; 33 | } 34 | 35 | - (void)downloadURL:(NSURL *)url toPath:(NSString *)path progress:(MPOFileDownloadProgressBlock)progress completion:(MPOFileDownloadCompletionBlock)completion 36 | { 37 | if (!completion) { 38 | completion = ^(NSError * error) { 39 | 40 | }; 41 | } 42 | 43 | if (self.downloading) { 44 | return completion([self _errorWithCode:MPOSimpleFileDownloaderErrorCodeAlreadyDownloading]); 45 | } 46 | 47 | if (!url.absoluteString.length || !path.length) { 48 | return completion([self _errorWithCode:MPOSimpleFileDownloaderErrorCodeInvalidParamaters]); 49 | } 50 | 51 | if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { 52 | return completion([self _errorWithCode:MPOSimpleFileDownloaderErrorCodeFileExists]); 53 | } 54 | 55 | _outputPath = path; 56 | _progressBlock = progress; 57 | _completionBlock = completion; 58 | 59 | if (!_fileOutputStream) { 60 | _fileOutputStream = [NSOutputStream outputStreamToFileAtPath:_outputPath append:NO]; 61 | [_fileOutputStream open]; 62 | } 63 | 64 | NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:url]; 65 | request.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData; 66 | 67 | _currentConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; 68 | [_currentConnection start]; 69 | } 70 | 71 | - (BOOL)downloading 72 | { 73 | return _currentConnection != nil; 74 | } 75 | 76 | - (void)cancelCurrentDownload 77 | { 78 | if (_currentConnection) { 79 | [_currentConnection cancel]; 80 | _currentConnection = nil; 81 | 82 | [self _completeWithError:[self _errorWithCode:MPOSimpleFileDownloaderErrorCodeCancelled]]; 83 | } 84 | } 85 | 86 | - (long long)currentDownloadSpeedBytesPerSecond 87 | { 88 | return _throughputHistory.currentBytesPerSeconds; 89 | } 90 | 91 | - (void)_completeWithError:(NSError *)error 92 | { 93 | [self _closeOutputStreamIfNeeded]; 94 | 95 | if (_currentConnection) { 96 | _currentConnection = nil; 97 | } 98 | 99 | if (error.domain == MPOSimpleFileDownloaderErrorDomain && error.code == MPOSimpleFileDownloaderErrorCodeCancelled) { 100 | [[NSFileManager defaultManager] removeItemAtPath:_outputPath error:NULL]; 101 | [[NSWorkspace sharedWorkspace] noteFileSystemChanged:_outputPath]; 102 | } 103 | 104 | if (_completionBlock) { 105 | _completionBlock(error); 106 | } 107 | 108 | [self _reset]; 109 | } 110 | 111 | - (void)_updateProgress 112 | { 113 | if (_fileTotalBytes && _progressBlock) { 114 | _progressBlock(_fileBytesWritten, _fileTotalBytes); 115 | } 116 | } 117 | 118 | - (void)_closeOutputStreamIfNeeded 119 | { 120 | if (!_fileOutputStream) { 121 | return; 122 | } 123 | [_fileOutputStream close]; 124 | _fileOutputStream = nil; 125 | } 126 | 127 | - (void)_reset 128 | { 129 | [self _closeOutputStreamIfNeeded]; 130 | 131 | _throughputHistory = nil; 132 | _outputPath = nil; 133 | _completionBlock = NULL; 134 | _progressBlock = NULL; 135 | _fileTotalBytes = 0; 136 | _fileBytesWritten = 0; 137 | } 138 | 139 | - (NSError *)_errorWithCode:(MPOSimpleFileDownloaderErrorCode)errorCode 140 | { 141 | return [NSError errorWithDomain:MPOSimpleFileDownloaderErrorDomain code:errorCode userInfo:nil]; 142 | } 143 | 144 | - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 145 | { 146 | _fileTotalBytes = response.expectedContentLength; 147 | 148 | [self _updateProgress]; 149 | 150 | if (!_throughputHistory) { 151 | _throughputHistory = [[MPOThroughputHistory alloc] initWithMaximumMeasurementsToKeep:50]; 152 | [_throughputHistory startMeasurement]; 153 | } 154 | } 155 | 156 | - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 157 | { 158 | NSUInteger length = data.length; 159 | 160 | _fileBytesWritten += [_fileOutputStream write:data.bytes maxLength:length]; 161 | 162 | [_throughputHistory push:length]; 163 | 164 | [self _updateProgress]; 165 | } 166 | 167 | - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 168 | { 169 | [self _completeWithError:error]; 170 | } 171 | 172 | - (void)connectionDidFinishLoading:(NSURLConnection *)connection 173 | { 174 | [self _updateProgress]; 175 | 176 | NSError * error = nil; 177 | 178 | if (_fileBytesWritten < _fileTotalBytes) { 179 | error = [self _errorWithCode:MPOSimpleFileDownloaderErrorCodeUnexpectedEOF]; 180 | } 181 | 182 | [self _completeWithError:error]; 183 | } 184 | 185 | @end 186 | 187 | NSString * const MPOSimpleFileDownloaderErrorDomain = @"MPOSimpleFileDownloaderErrorDomain"; 188 | -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOThroughputHistory.h: -------------------------------------------------------------------------------- 1 | // 2 | // MPOThroughputHistory.h 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/12. 6 | // 7 | 8 | #import 9 | 10 | @interface MPOThroughputHistory : NSObject 11 | 12 | - (instancetype)initWithMaximumMeasurementsToKeep:(NSUInteger)numberOfMeasurements; 13 | 14 | - (void)startMeasurement; 15 | - (void)push:(long long)byteLength; 16 | 17 | @property (nonatomic, assign, readonly) long long currentBytesPerSeconds; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /MPOFinderFileDownloader/MPOThroughputHistory.m: -------------------------------------------------------------------------------- 1 | // 2 | // MPOThroughputHistory.m 3 | // MPOFinderFileDownloader 4 | // 5 | // Created by 吴天 on 2018/1/12. 6 | // 7 | 8 | #import "MPOThroughputHistory.h" 9 | 10 | @interface MPOThroughputHistoryRecord : NSObject 11 | 12 | @property (nonatomic, assign, readonly) long long bytes; 13 | @property (nonatomic, assign, readonly) NSTimeInterval timeElapsed; 14 | 15 | + (instancetype)recordWithBytes:(long long)bytes timeElapsed:(NSTimeInterval)timeElapsed; 16 | 17 | @end 18 | 19 | @implementation MPOThroughputHistoryRecord 20 | 21 | + (instancetype)recordWithBytes:(long long)bytes timeElapsed:(NSTimeInterval)timeElapsed 22 | { 23 | MPOThroughputHistoryRecord * record = [MPOThroughputHistoryRecord new]; 24 | record->_bytes = bytes; 25 | record->_timeElapsed = timeElapsed; 26 | return record; 27 | } 28 | 29 | @end 30 | 31 | @interface MPOThroughputHistory () 32 | 33 | @property (nonatomic, assign) NSUInteger maximumMeasurementsToKeep; 34 | @property (nonatomic, strong) NSMutableArray * measurements; 35 | @property (nonatomic, assign) CFAbsoluteTime lastestTimestamp; 36 | 37 | @end 38 | 39 | @implementation MPOThroughputHistory 40 | 41 | - (instancetype)init 42 | { 43 | if (self = [super init]) { 44 | _maximumMeasurementsToKeep = 20; 45 | _measurements = [NSMutableArray array]; 46 | } 47 | return self; 48 | } 49 | 50 | - (instancetype)initWithMaximumMeasurementsToKeep:(NSUInteger)numberOfMeasurements 51 | { 52 | if (self = [self init]) { 53 | _maximumMeasurementsToKeep = numberOfMeasurements; 54 | } 55 | return self; 56 | } 57 | 58 | - (void)_reset 59 | { 60 | [_measurements removeAllObjects]; 61 | _lastestTimestamp = CFAbsoluteTimeGetCurrent(); 62 | } 63 | 64 | - (void)startMeasurement 65 | { 66 | [self _reset]; 67 | } 68 | 69 | - (void)push:(long long)byteLength 70 | { 71 | CFAbsoluteTime current = CFAbsoluteTimeGetCurrent(); 72 | MPOThroughputHistoryRecord * record = [MPOThroughputHistoryRecord recordWithBytes:byteLength timeElapsed:(current - _lastestTimestamp)]; 73 | [_measurements addObject:record]; 74 | while (_measurements.count > _maximumMeasurementsToKeep) { 75 | [_measurements removeObjectAtIndex:0]; 76 | } 77 | _lastestTimestamp = current; 78 | } 79 | 80 | - (long long)currentBytesPerSeconds 81 | { 82 | long long totalBytes = 0; 83 | NSTimeInterval totalTime = 0; 84 | for (MPOThroughputHistoryRecord * record in _measurements) { 85 | totalBytes += record.bytes; 86 | totalTime += record.timeElapsed; 87 | } 88 | if (totalTime <= 0) { 89 | return totalBytes; 90 | } 91 | return totalBytes / totalTime; 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MPOFinderFileDownloader 2 | 3 | A simple file downloader adds progress indicator to finder file icon when downloading 4 | 5 | ![screenshot](screenshot.gif) 6 | 7 | # License 8 | 9 | MIT 10 | 11 | 12 | -------------------------------------------------------------------------------- /screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Naituw/MPOFinderFileDownloader/da5a71a1b310ced4657124312578d6a2986f1581/screenshot.gif --------------------------------------------------------------------------------