├── .gitignore ├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Example.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Example │ ├── Assets.xcassets │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── ContentView.swift │ ├── Example.plist │ ├── ExampleApp.swift │ └── Preview Content │ │ └── Preview Assets.xcassets │ │ └── Contents.json ├── Podfile ├── Podfile.lock └── Pods │ ├── Local Podspecs │ └── SSMediaLibrary.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ └── project.pbxproj │ └── Target Support Files │ ├── Pods-Example │ ├── Pods-Example-Info.plist │ ├── Pods-Example-acknowledgements.markdown │ ├── Pods-Example-acknowledgements.plist │ ├── Pods-Example-dummy.m │ ├── Pods-Example-frameworks-Debug-input-files.xcfilelist │ ├── Pods-Example-frameworks-Debug-output-files.xcfilelist │ ├── Pods-Example-frameworks-Release-input-files.xcfilelist │ ├── Pods-Example-frameworks-Release-output-files.xcfilelist │ ├── Pods-Example-frameworks.sh │ ├── Pods-Example-umbrella.h │ ├── Pods-Example.debug.xcconfig │ ├── Pods-Example.modulemap │ └── Pods-Example.release.xcconfig │ └── SSMediaLibrary │ ├── SSMediaLibrary-Info.plist │ ├── SSMediaLibrary-dummy.m │ ├── SSMediaLibrary-prefix.pch │ ├── SSMediaLibrary-umbrella.h │ ├── SSMediaLibrary.debug.xcconfig │ ├── SSMediaLibrary.modulemap │ └── SSMediaLibrary.release.xcconfig ├── Package.swift ├── README.md ├── SSMediaLibrary.podspec ├── SSMediaLibrary.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── xcshareddata │ └── xcschemes │ └── SSMediaLibrary.xcscheme ├── SSMediaLibrary ├── .gitignore └── SSMediaLibrary │ ├── SSMediaLibrary.docc │ └── Classes │ │ ├── MediaManager.swift │ │ ├── NetworkManager.swift │ │ └── UTI.swift │ └── SSMediaLibraryHeader.h ├── SSMediaLibraryExample.gif └── Sources └── SSMediaLibrary ├── MediaManager.swift ├── NetworkManager.swift └── UTI.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 53; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1A80CA0F2704BA42001CB33F /* ExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A770F422704845F0080AA64 /* ExampleApp.swift */; }; 11 | 1A80CA102704BA42001CB33F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A770F442704845F0080AA64 /* ContentView.swift */; }; 12 | 556C691F9AAF983F25986980 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 621F505BD87C387E8011A7DD /* Pods_Example.framework */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXFileReference section */ 16 | 1A770F3F2704845F0080AA64 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 17 | 1A770F422704845F0080AA64 /* ExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleApp.swift; sourceTree = ""; }; 18 | 1A770F442704845F0080AA64 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 19 | 1A770F46270484730080AA64 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 20 | 1A770F49270484730080AA64 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 21 | 1A770F52270488090080AA64 /* Example.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Example.plist; sourceTree = ""; }; 22 | 4675202BB632C22ABF134E85 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; 23 | 621F505BD87C387E8011A7DD /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 6FAF144850D8F0B1944FC4D7 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | 1A770F3C2704845F0080AA64 /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | 556C691F9AAF983F25986980 /* Pods_Example.framework in Frameworks */, 33 | ); 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXFrameworksBuildPhase section */ 37 | 38 | /* Begin PBXGroup section */ 39 | 1A770F362704845F0080AA64 = { 40 | isa = PBXGroup; 41 | children = ( 42 | 1A770F412704845F0080AA64 /* Example */, 43 | 1A770F402704845F0080AA64 /* Products */, 44 | 626B28B919941DC1508CBF6B /* Pods */, 45 | 6EB3312EE2255DC0B8F572F9 /* Frameworks */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | 1A770F402704845F0080AA64 /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 1A770F3F2704845F0080AA64 /* Example.app */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | 1A770F412704845F0080AA64 /* Example */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 1A770F422704845F0080AA64 /* ExampleApp.swift */, 61 | 1A770F442704845F0080AA64 /* ContentView.swift */, 62 | 1A770F46270484730080AA64 /* Assets.xcassets */, 63 | 1A770F48270484730080AA64 /* Preview Content */, 64 | 1A770F52270488090080AA64 /* Example.plist */, 65 | ); 66 | path = Example; 67 | sourceTree = ""; 68 | }; 69 | 1A770F48270484730080AA64 /* Preview Content */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 1A770F49270484730080AA64 /* Preview Assets.xcassets */, 73 | ); 74 | path = "Preview Content"; 75 | sourceTree = ""; 76 | }; 77 | 626B28B919941DC1508CBF6B /* Pods */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 6FAF144850D8F0B1944FC4D7 /* Pods-Example.debug.xcconfig */, 81 | 4675202BB632C22ABF134E85 /* Pods-Example.release.xcconfig */, 82 | ); 83 | path = Pods; 84 | sourceTree = ""; 85 | }; 86 | 6EB3312EE2255DC0B8F572F9 /* Frameworks */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 621F505BD87C387E8011A7DD /* Pods_Example.framework */, 90 | ); 91 | name = Frameworks; 92 | sourceTree = ""; 93 | }; 94 | /* End PBXGroup section */ 95 | 96 | /* Begin PBXNativeTarget section */ 97 | 1A770F3E2704845F0080AA64 /* Example */ = { 98 | isa = PBXNativeTarget; 99 | buildConfigurationList = 1A770F4D270484730080AA64 /* Build configuration list for PBXNativeTarget "Example" */; 100 | buildPhases = ( 101 | B15EDA68241E26EEA687BB6F /* [CP] Check Pods Manifest.lock */, 102 | 1A770F3B2704845F0080AA64 /* Sources */, 103 | 1A770F3C2704845F0080AA64 /* Frameworks */, 104 | 0B2BB10C8B3E3364A28E9D26 /* [CP] Embed Pods Frameworks */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = Example; 111 | productName = Example; 112 | productReference = 1A770F3F2704845F0080AA64 /* Example.app */; 113 | productType = "com.apple.product-type.application"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | 1A770F372704845F0080AA64 /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | BuildIndependentTargetsInParallel = 1; 122 | LastSwiftUpdateCheck = 1300; 123 | LastUpgradeCheck = 1300; 124 | TargetAttributes = { 125 | 1A770F3E2704845F0080AA64 = { 126 | CreatedOnToolsVersion = 13.0; 127 | }; 128 | }; 129 | }; 130 | buildConfigurationList = 1A770F3A2704845F0080AA64 /* Build configuration list for PBXProject "Example" */; 131 | compatibilityVersion = "Xcode 11.0"; 132 | developmentRegion = en; 133 | hasScannedForEncodings = 0; 134 | knownRegions = ( 135 | en, 136 | Base, 137 | ); 138 | mainGroup = 1A770F362704845F0080AA64; 139 | productRefGroup = 1A770F402704845F0080AA64 /* Products */; 140 | projectDirPath = ""; 141 | projectRoot = ""; 142 | targets = ( 143 | 1A770F3E2704845F0080AA64 /* Example */, 144 | ); 145 | }; 146 | /* End PBXProject section */ 147 | 148 | /* Begin PBXShellScriptBuildPhase section */ 149 | 0B2BB10C8B3E3364A28E9D26 /* [CP] Embed Pods Frameworks */ = { 150 | isa = PBXShellScriptBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | ); 154 | inputFileListPaths = ( 155 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks-${CONFIGURATION}-input-files.xcfilelist", 156 | ); 157 | name = "[CP] Embed Pods Frameworks"; 158 | outputFileListPaths = ( 159 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks-${CONFIGURATION}-output-files.xcfilelist", 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | shellPath = /bin/sh; 163 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; 164 | showEnvVarsInLog = 0; 165 | }; 166 | B15EDA68241E26EEA687BB6F /* [CP] Check Pods Manifest.lock */ = { 167 | isa = PBXShellScriptBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | ); 171 | inputFileListPaths = ( 172 | ); 173 | inputPaths = ( 174 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 175 | "${PODS_ROOT}/Manifest.lock", 176 | ); 177 | name = "[CP] Check Pods Manifest.lock"; 178 | outputFileListPaths = ( 179 | ); 180 | outputPaths = ( 181 | "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", 182 | ); 183 | runOnlyForDeploymentPostprocessing = 0; 184 | shellPath = /bin/sh; 185 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 186 | showEnvVarsInLog = 0; 187 | }; 188 | /* End PBXShellScriptBuildPhase section */ 189 | 190 | /* Begin PBXSourcesBuildPhase section */ 191 | 1A770F3B2704845F0080AA64 /* Sources */ = { 192 | isa = PBXSourcesBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | 1A80CA0F2704BA42001CB33F /* ExampleApp.swift in Sources */, 196 | 1A80CA102704BA42001CB33F /* ContentView.swift in Sources */, 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | /* End PBXSourcesBuildPhase section */ 201 | 202 | /* Begin XCBuildConfiguration section */ 203 | 1A770F4B270484730080AA64 /* Debug */ = { 204 | isa = XCBuildConfiguration; 205 | buildSettings = { 206 | ALWAYS_SEARCH_USER_PATHS = NO; 207 | CLANG_ANALYZER_NONNULL = YES; 208 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 209 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 210 | CLANG_CXX_LIBRARY = "libc++"; 211 | CLANG_ENABLE_MODULES = YES; 212 | CLANG_ENABLE_OBJC_ARC = YES; 213 | CLANG_ENABLE_OBJC_WEAK = YES; 214 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 215 | CLANG_WARN_BOOL_CONVERSION = YES; 216 | CLANG_WARN_COMMA = YES; 217 | CLANG_WARN_CONSTANT_CONVERSION = YES; 218 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 219 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 220 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 221 | CLANG_WARN_EMPTY_BODY = YES; 222 | CLANG_WARN_ENUM_CONVERSION = YES; 223 | CLANG_WARN_INFINITE_RECURSION = YES; 224 | CLANG_WARN_INT_CONVERSION = YES; 225 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 226 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 227 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 228 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 229 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 230 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 231 | CLANG_WARN_STRICT_PROTOTYPES = YES; 232 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 233 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 234 | CLANG_WARN_UNREACHABLE_CODE = YES; 235 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 236 | COPY_PHASE_STRIP = NO; 237 | DEBUG_INFORMATION_FORMAT = dwarf; 238 | ENABLE_STRICT_OBJC_MSGSEND = YES; 239 | ENABLE_TESTABILITY = YES; 240 | GCC_C_LANGUAGE_STANDARD = gnu11; 241 | GCC_DYNAMIC_NO_PIC = NO; 242 | GCC_NO_COMMON_BLOCKS = YES; 243 | GCC_OPTIMIZATION_LEVEL = 0; 244 | GCC_PREPROCESSOR_DEFINITIONS = ( 245 | "DEBUG=1", 246 | "$(inherited)", 247 | ); 248 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 250 | GCC_WARN_UNDECLARED_SELECTOR = YES; 251 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 252 | GCC_WARN_UNUSED_FUNCTION = YES; 253 | GCC_WARN_UNUSED_VARIABLE = YES; 254 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 255 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 256 | MTL_FAST_MATH = YES; 257 | ONLY_ACTIVE_ARCH = YES; 258 | SDKROOT = iphoneos; 259 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 260 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 261 | }; 262 | name = Debug; 263 | }; 264 | 1A770F4C270484730080AA64 /* Release */ = { 265 | isa = XCBuildConfiguration; 266 | buildSettings = { 267 | ALWAYS_SEARCH_USER_PATHS = NO; 268 | CLANG_ANALYZER_NONNULL = YES; 269 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_ENABLE_OBJC_WEAK = YES; 275 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 276 | CLANG_WARN_BOOL_CONVERSION = YES; 277 | CLANG_WARN_COMMA = YES; 278 | CLANG_WARN_CONSTANT_CONVERSION = YES; 279 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 281 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 282 | CLANG_WARN_EMPTY_BODY = YES; 283 | CLANG_WARN_ENUM_CONVERSION = YES; 284 | CLANG_WARN_INFINITE_RECURSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 287 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 288 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 289 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 290 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 291 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 292 | CLANG_WARN_STRICT_PROTOTYPES = YES; 293 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 294 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | COPY_PHASE_STRIP = NO; 298 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 299 | ENABLE_NS_ASSERTIONS = NO; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu11; 302 | GCC_NO_COMMON_BLOCKS = YES; 303 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 304 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 305 | GCC_WARN_UNDECLARED_SELECTOR = YES; 306 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 307 | GCC_WARN_UNUSED_FUNCTION = YES; 308 | GCC_WARN_UNUSED_VARIABLE = YES; 309 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 310 | MTL_ENABLE_DEBUG_INFO = NO; 311 | MTL_FAST_MATH = YES; 312 | SDKROOT = iphoneos; 313 | SWIFT_COMPILATION_MODE = wholemodule; 314 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 315 | VALIDATE_PRODUCT = YES; 316 | }; 317 | name = Release; 318 | }; 319 | 1A770F4E270484730080AA64 /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | baseConfigurationReference = 6FAF144850D8F0B1944FC4D7 /* Pods-Example.debug.xcconfig */; 322 | buildSettings = { 323 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 324 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 325 | CODE_SIGN_STYLE = Automatic; 326 | CURRENT_PROJECT_VERSION = 1; 327 | DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\""; 328 | ENABLE_PREVIEWS = YES; 329 | GENERATE_INFOPLIST_FILE = YES; 330 | INFOPLIST_FILE = Example/Example.plist; 331 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 332 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 333 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 334 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 335 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 336 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 337 | LD_RUNPATH_SEARCH_PATHS = ( 338 | "$(inherited)", 339 | "@executable_path/Frameworks", 340 | ); 341 | MARKETING_VERSION = 1.0; 342 | PRODUCT_BUNDLE_IDENTIFIER = com.simformsolutions.Example; 343 | PRODUCT_NAME = "$(TARGET_NAME)"; 344 | SWIFT_EMIT_LOC_STRINGS = YES; 345 | SWIFT_VERSION = 5.0; 346 | TARGETED_DEVICE_FAMILY = "1,2"; 347 | }; 348 | name = Debug; 349 | }; 350 | 1A770F4F270484730080AA64 /* Release */ = { 351 | isa = XCBuildConfiguration; 352 | baseConfigurationReference = 4675202BB632C22ABF134E85 /* Pods-Example.release.xcconfig */; 353 | buildSettings = { 354 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 355 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 356 | CODE_SIGN_STYLE = Automatic; 357 | CURRENT_PROJECT_VERSION = 1; 358 | DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\""; 359 | ENABLE_PREVIEWS = YES; 360 | GENERATE_INFOPLIST_FILE = YES; 361 | INFOPLIST_FILE = Example/Example.plist; 362 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 363 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 364 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 365 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 366 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 367 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 368 | LD_RUNPATH_SEARCH_PATHS = ( 369 | "$(inherited)", 370 | "@executable_path/Frameworks", 371 | ); 372 | MARKETING_VERSION = 1.0; 373 | PRODUCT_BUNDLE_IDENTIFIER = com.simformsolutions.Example; 374 | PRODUCT_NAME = "$(TARGET_NAME)"; 375 | SWIFT_EMIT_LOC_STRINGS = YES; 376 | SWIFT_VERSION = 5.0; 377 | TARGETED_DEVICE_FAMILY = "1,2"; 378 | }; 379 | name = Release; 380 | }; 381 | /* End XCBuildConfiguration section */ 382 | 383 | /* Begin XCConfigurationList section */ 384 | 1A770F3A2704845F0080AA64 /* Build configuration list for PBXProject "Example" */ = { 385 | isa = XCConfigurationList; 386 | buildConfigurations = ( 387 | 1A770F4B270484730080AA64 /* Debug */, 388 | 1A770F4C270484730080AA64 /* Release */, 389 | ); 390 | defaultConfigurationIsVisible = 0; 391 | defaultConfigurationName = Release; 392 | }; 393 | 1A770F4D270484730080AA64 /* Build configuration list for PBXNativeTarget "Example" */ = { 394 | isa = XCConfigurationList; 395 | buildConfigurations = ( 396 | 1A770F4E270484730080AA64 /* Debug */, 397 | 1A770F4F270484730080AA64 /* Release */, 398 | ); 399 | defaultConfigurationIsVisible = 0; 400 | defaultConfigurationName = Release; 401 | }; 402 | /* End XCConfigurationList section */ 403 | }; 404 | rootObject = 1A770F372704845F0080AA64 /* Project object */; 405 | } 406 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Example/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // Example 4 | // 5 | // Created by Devansh Vyas on 29/09/21. 6 | // 7 | 8 | import SwiftUI 9 | import SSMediaLibrary 10 | 11 | struct ContentView: View { 12 | var body: some View { 13 | VStack { 14 | Button(action: showPdf) { 15 | Label("Show PDF", systemImage: "plus") 16 | }.padding() 17 | Button(action: showImage) { 18 | Label("Show Image", systemImage: "plus") 19 | }.padding() 20 | Button(action: showVideo) { 21 | Label("Show Video", systemImage: "plus") 22 | }.padding() 23 | } 24 | } 25 | 26 | private func showPdf() { 27 | guard let url = URL(string: "http://www.africau.edu/images/default/sample.pdf") else { return } 28 | let manager = MediaManager(url: url) 29 | manager.show() 30 | } 31 | 32 | private func showImage() { 33 | guard let url = URL(string: "https://file-examples-com.github.io/uploads/2017/10/file_example_JPG_100kB.jpg") else { return } 34 | let manager = MediaManager(url: url) 35 | manager.show() 36 | } 37 | 38 | private func showVideo() { 39 | guard let url = URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4") else { return } 40 | let manager = MediaManager(url: url) 41 | manager.show() 42 | } 43 | } 44 | 45 | struct ContentView_Previews: PreviewProvider { 46 | static var previews: some View { 47 | ContentView() 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Example/Example/Example.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NSAppTransportSecurity 5 | 6 | NSAllowsArbitraryLoads 7 | 8 | 9 | UIFileSharingEnabled 10 | 11 | LSSupportsOpeningDocumentsInPlace 12 | 13 | UISupportsDocumentBrowser 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Example/Example/ExampleApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleApp.swift 3 | // Example 4 | // 5 | // Created by Devansh Vyas on 29/09/21. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct ExampleApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/Example/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'Example' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | use_frameworks! 7 | pod 'SSMediaLibrary', :path => '../' 8 | 9 | end 10 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SSMediaLibrary (0.1.8) 3 | 4 | DEPENDENCIES: 5 | - SSMediaLibrary (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | SSMediaLibrary: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | SSMediaLibrary: 86080f3f221da70fec2e9124ac50f6eb6d17286e 13 | 14 | PODFILE CHECKSUM: 263ea283182988d2e921b46224197236fdcbd8a2 15 | 16 | COCOAPODS: 1.11.2 17 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/SSMediaLibrary.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SSMediaLibrary", 3 | "platforms": { 4 | "ios": "13.0" 5 | }, 6 | "summary": "SSMediaLibrary lets a user open any file", 7 | "version": "0.1.8", 8 | "license": { 9 | "type": "MIT", 10 | "file": "LICENSE" 11 | }, 12 | "authors": { 13 | "Devansh Vyas": "devansh.v@simformsolutions.com" 14 | }, 15 | "homepage": "https://github.com/devansh-v-simformsolutions/SSMediaLibrary", 16 | "source": { 17 | "git": "https://github.com/devansh-v-simformsolutions/SSMediaLibrary.git", 18 | "tag": "0.1.8" 19 | }, 20 | "frameworks": "UIKit", 21 | "source_files": "SSMediaLibrary/**/*.{h,m,swift}", 22 | "swift_versions": "5.0", 23 | "swift_version": "5.0" 24 | } 25 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - SSMediaLibrary (0.1.8) 3 | 4 | DEPENDENCIES: 5 | - SSMediaLibrary (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | SSMediaLibrary: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | SSMediaLibrary: 86080f3f221da70fec2e9124ac50f6eb6d17286e 13 | 14 | PODFILE CHECKSUM: 263ea283182988d2e921b46224197236fdcbd8a2 15 | 16 | COCOAPODS: 1.11.2 17 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0983525B83F21BE3DF46A7C4B99041CB /* Pods-Example-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 7825A90E082A1582EB16256B0E722B3F /* Pods-Example-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 3BFD8A84253CE5A576E41B4DC5EA763C /* SSMediaLibrary-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 67D1F5F988620480B90CB93A171BC2DF /* SSMediaLibrary-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 6CBD4C98BC8042A339063B072E6D6874 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 870F89D96322D2B3696468F08D54926F /* NetworkManager.swift */; }; 13 | 7F81B2E107AC0243DA7EA6EF2C9DE36D /* Pods-Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D6D7C498FA339E02BD53ECB8916CEA8E /* Pods-Example-dummy.m */; }; 14 | B01EEBE88B16441A2596B61BB3A2CEA0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D245E0514AAC1A2B9A6D5EA2F383E90F /* UIKit.framework */; }; 15 | B0FBF721684C12A41A8043EFDE5CAEE3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAB6F611E86A4758835A715E4B4184F6 /* Foundation.framework */; }; 16 | B402F83B7461667F4E394D1B52B76159 /* UTI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D30D732F5665B2BB74BBFAF3D340069 /* UTI.swift */; }; 17 | C83B7B22CCBA4311546A984BD214CE69 /* SSMediaLibrary-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EAE951EA81303A85DB2B3289F2EF549 /* SSMediaLibrary-dummy.m */; }; 18 | EDE06F25C1FDA1468BE695B344752B1F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAB6F611E86A4758835A715E4B4184F6 /* Foundation.framework */; }; 19 | EFE0A6EA7EE235CF40A3EEC6069F1652 /* MediaManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C75B8D3A22B0EE05DE10DFCC28E00D /* MediaManager.swift */; }; 20 | F623A4252FF834DFA2562860D805A573 /* SSMediaLibraryHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = D2E5E497B5C6D28D9E10176E92DAA0E1 /* SSMediaLibraryHeader.h */; settings = {ATTRIBUTES = (Public, ); }; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | DA41B6F0479B0918694BA200EEB44AC0 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 0795C0BFDFF80202A0DC79AF5B97EA98; 29 | remoteInfo = SSMediaLibrary; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 05733170E54DC1797107A87BD32C330B /* SSMediaLibrary.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SSMediaLibrary.modulemap; sourceTree = ""; }; 35 | 0DFF6987DFDC5DE8E2EEDA1679D53269 /* SSMediaLibrary-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SSMediaLibrary-prefix.pch"; sourceTree = ""; }; 36 | 189AAB4D5702FD1962CA63F974759184 /* SSMediaLibrary.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; path = SSMediaLibrary.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 37 | 1F667CC0E19EAF34E5A4119E2121F585 /* Pods-Example */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-Example"; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 243410B9535472556EA4BB6DBC133A0D /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Example.release.xcconfig"; sourceTree = ""; }; 39 | 31C1D37707DFAA5E6A164BCC07834264 /* Pods-Example-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Example-Info.plist"; sourceTree = ""; }; 40 | 35C305D3797C284E6F5BAA1D3E6F9BF8 /* Pods-Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-Example.modulemap"; sourceTree = ""; }; 41 | 3A69D38064CD51E23BB05FF36F1F0523 /* SSMediaLibrary.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SSMediaLibrary.debug.xcconfig; sourceTree = ""; }; 42 | 441854E35F81731E63E53DC7E4EEAD9D /* Pods-Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Example-acknowledgements.markdown"; sourceTree = ""; }; 43 | 55E4409A399567D4900869E9EB1AC71B /* SSMediaLibrary-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SSMediaLibrary-Info.plist"; sourceTree = ""; }; 44 | 67D1F5F988620480B90CB93A171BC2DF /* SSMediaLibrary-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SSMediaLibrary-umbrella.h"; sourceTree = ""; }; 45 | 7825A90E082A1582EB16256B0E722B3F /* Pods-Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Example-umbrella.h"; sourceTree = ""; }; 46 | 805BC1184394BC74E831632321CD1876 /* SSMediaLibrary */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SSMediaLibrary; path = SSMediaLibrary.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 851D3A9965983B6A8E5A2085C4EC0BA2 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; path = README.md; sourceTree = ""; }; 48 | 870F89D96322D2B3696468F08D54926F /* NetworkManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; 49 | 9D30D732F5665B2BB74BBFAF3D340069 /* UTI.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = UTI.swift; sourceTree = ""; }; 50 | 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 51 | 9EAE951EA81303A85DB2B3289F2EF549 /* SSMediaLibrary-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SSMediaLibrary-dummy.m"; sourceTree = ""; }; 52 | AFECBC24E09D0D25F822C27BD944AFD4 /* Pods-Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Example-frameworks.sh"; sourceTree = ""; }; 53 | B1C75B8D3A22B0EE05DE10DFCC28E00D /* MediaManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MediaManager.swift; sourceTree = ""; }; 54 | B45138496B85A072654D1D0F8EBBEDE5 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Example.debug.xcconfig"; sourceTree = ""; }; 55 | D245E0514AAC1A2B9A6D5EA2F383E90F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 56 | D2E5E497B5C6D28D9E10176E92DAA0E1 /* SSMediaLibraryHeader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SSMediaLibraryHeader.h; path = SSMediaLibrary/SSMediaLibrary/SSMediaLibraryHeader.h; sourceTree = ""; }; 57 | D6D7C498FA339E02BD53ECB8916CEA8E /* Pods-Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Example-dummy.m"; sourceTree = ""; }; 58 | DF23B3112FF8B45C9B44AC2AC5261E46 /* SSMediaLibrary.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SSMediaLibrary.release.xcconfig; sourceTree = ""; }; 59 | EA21B344259B58996DB73382B1B1521F /* Pods-Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Example-acknowledgements.plist"; sourceTree = ""; }; 60 | EAB6F611E86A4758835A715E4B4184F6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 079F8F9DE057C06138CF487A55AD8E2C /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | B0FBF721684C12A41A8043EFDE5CAEE3 /* Foundation.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | 7DA3957803A312A96123B24413833D47 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | EDE06F25C1FDA1468BE695B344752B1F /* Foundation.framework in Frameworks */, 77 | B01EEBE88B16441A2596B61BB3A2CEA0 /* UIKit.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 16283EC2A5232795929E0C49771803B6 /* SSMediaLibrary */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | D2E5E497B5C6D28D9E10176E92DAA0E1 /* SSMediaLibraryHeader.h */, 88 | 33936FFAEC3F54945704E20693E0FCC5 /* Pod */, 89 | 8FCABA371285BC9F1E7244F3794FCD7D /* SSMediaLibrary.docc */, 90 | 921706C6A0536399A572557E52904482 /* Support Files */, 91 | ); 92 | name = SSMediaLibrary; 93 | path = ../..; 94 | sourceTree = ""; 95 | }; 96 | 1628BF05B4CAFDCC3549A101F5A10A17 /* Frameworks */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 59DA5C1F72E1D5BABC43EACBA672C3BA /* iOS */, 100 | ); 101 | name = Frameworks; 102 | sourceTree = ""; 103 | }; 104 | 33936FFAEC3F54945704E20693E0FCC5 /* Pod */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 851D3A9965983B6A8E5A2085C4EC0BA2 /* README.md */, 108 | 189AAB4D5702FD1962CA63F974759184 /* SSMediaLibrary.podspec */, 109 | ); 110 | name = Pod; 111 | sourceTree = ""; 112 | }; 113 | 3FBB470C8B386C76E330EBDAECEA671C /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 1F667CC0E19EAF34E5A4119E2121F585 /* Pods-Example */, 117 | 805BC1184394BC74E831632321CD1876 /* SSMediaLibrary */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 400FFD520A169FA05B31231396DFFFD9 /* Classes */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | B1C75B8D3A22B0EE05DE10DFCC28E00D /* MediaManager.swift */, 126 | 870F89D96322D2B3696468F08D54926F /* NetworkManager.swift */, 127 | 9D30D732F5665B2BB74BBFAF3D340069 /* UTI.swift */, 128 | ); 129 | name = Classes; 130 | path = Classes; 131 | sourceTree = ""; 132 | }; 133 | 59DA5C1F72E1D5BABC43EACBA672C3BA /* iOS */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | EAB6F611E86A4758835A715E4B4184F6 /* Foundation.framework */, 137 | D245E0514AAC1A2B9A6D5EA2F383E90F /* UIKit.framework */, 138 | ); 139 | name = iOS; 140 | sourceTree = ""; 141 | }; 142 | 8FCABA371285BC9F1E7244F3794FCD7D /* SSMediaLibrary.docc */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 400FFD520A169FA05B31231396DFFFD9 /* Classes */, 146 | ); 147 | name = SSMediaLibrary.docc; 148 | path = SSMediaLibrary/SSMediaLibrary/SSMediaLibrary.docc; 149 | sourceTree = ""; 150 | }; 151 | 921706C6A0536399A572557E52904482 /* Support Files */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 05733170E54DC1797107A87BD32C330B /* SSMediaLibrary.modulemap */, 155 | 9EAE951EA81303A85DB2B3289F2EF549 /* SSMediaLibrary-dummy.m */, 156 | 55E4409A399567D4900869E9EB1AC71B /* SSMediaLibrary-Info.plist */, 157 | 0DFF6987DFDC5DE8E2EEDA1679D53269 /* SSMediaLibrary-prefix.pch */, 158 | 67D1F5F988620480B90CB93A171BC2DF /* SSMediaLibrary-umbrella.h */, 159 | 3A69D38064CD51E23BB05FF36F1F0523 /* SSMediaLibrary.debug.xcconfig */, 160 | DF23B3112FF8B45C9B44AC2AC5261E46 /* SSMediaLibrary.release.xcconfig */, 161 | ); 162 | name = "Support Files"; 163 | path = "Example/Pods/Target Support Files/SSMediaLibrary"; 164 | sourceTree = ""; 165 | }; 166 | 9BDBD95ED116334D1B2835202D8D3060 /* Pods-Example */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 35C305D3797C284E6F5BAA1D3E6F9BF8 /* Pods-Example.modulemap */, 170 | 441854E35F81731E63E53DC7E4EEAD9D /* Pods-Example-acknowledgements.markdown */, 171 | EA21B344259B58996DB73382B1B1521F /* Pods-Example-acknowledgements.plist */, 172 | D6D7C498FA339E02BD53ECB8916CEA8E /* Pods-Example-dummy.m */, 173 | AFECBC24E09D0D25F822C27BD944AFD4 /* Pods-Example-frameworks.sh */, 174 | 31C1D37707DFAA5E6A164BCC07834264 /* Pods-Example-Info.plist */, 175 | 7825A90E082A1582EB16256B0E722B3F /* Pods-Example-umbrella.h */, 176 | B45138496B85A072654D1D0F8EBBEDE5 /* Pods-Example.debug.xcconfig */, 177 | 243410B9535472556EA4BB6DBC133A0D /* Pods-Example.release.xcconfig */, 178 | ); 179 | name = "Pods-Example"; 180 | path = "Target Support Files/Pods-Example"; 181 | sourceTree = ""; 182 | }; 183 | CE2E825F08D3AD0FD76E6D78D7512ED0 /* Targets Support Files */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | 9BDBD95ED116334D1B2835202D8D3060 /* Pods-Example */, 187 | ); 188 | name = "Targets Support Files"; 189 | sourceTree = ""; 190 | }; 191 | CF1408CF629C7361332E53B88F7BD30C = { 192 | isa = PBXGroup; 193 | children = ( 194 | 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, 195 | EA403F5101BE5F5E87471897AA751CA7 /* Development Pods */, 196 | 1628BF05B4CAFDCC3549A101F5A10A17 /* Frameworks */, 197 | 3FBB470C8B386C76E330EBDAECEA671C /* Products */, 198 | CE2E825F08D3AD0FD76E6D78D7512ED0 /* Targets Support Files */, 199 | ); 200 | sourceTree = ""; 201 | }; 202 | EA403F5101BE5F5E87471897AA751CA7 /* Development Pods */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | 16283EC2A5232795929E0C49771803B6 /* SSMediaLibrary */, 206 | ); 207 | name = "Development Pods"; 208 | sourceTree = ""; 209 | }; 210 | /* End PBXGroup section */ 211 | 212 | /* Begin PBXHeadersBuildPhase section */ 213 | 3C69E3330FF45E8EC70572AA79D8530A /* Headers */ = { 214 | isa = PBXHeadersBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | 0983525B83F21BE3DF46A7C4B99041CB /* Pods-Example-umbrella.h in Headers */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | 7A3F9609E1527CDFA1F398CF4DE2EA85 /* Headers */ = { 222 | isa = PBXHeadersBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | 3BFD8A84253CE5A576E41B4DC5EA763C /* SSMediaLibrary-umbrella.h in Headers */, 226 | F623A4252FF834DFA2562860D805A573 /* SSMediaLibraryHeader.h in Headers */, 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | /* End PBXHeadersBuildPhase section */ 231 | 232 | /* Begin PBXNativeTarget section */ 233 | 0795C0BFDFF80202A0DC79AF5B97EA98 /* SSMediaLibrary */ = { 234 | isa = PBXNativeTarget; 235 | buildConfigurationList = BA98B4318A10023517E5B80E41F0FBEA /* Build configuration list for PBXNativeTarget "SSMediaLibrary" */; 236 | buildPhases = ( 237 | 7A3F9609E1527CDFA1F398CF4DE2EA85 /* Headers */, 238 | 23CB8445D7B5FD57D42300CF6096C646 /* Sources */, 239 | 7DA3957803A312A96123B24413833D47 /* Frameworks */, 240 | 6454381E51ACECDDD64CD925F594EBFF /* Resources */, 241 | ); 242 | buildRules = ( 243 | ); 244 | dependencies = ( 245 | ); 246 | name = SSMediaLibrary; 247 | productName = SSMediaLibrary; 248 | productReference = 805BC1184394BC74E831632321CD1876 /* SSMediaLibrary */; 249 | productType = "com.apple.product-type.framework"; 250 | }; 251 | 0AEE99A309977BD12A049FF48AF9BA4B /* Pods-Example */ = { 252 | isa = PBXNativeTarget; 253 | buildConfigurationList = E141379FAE3449D6CB8755EFA08CD315 /* Build configuration list for PBXNativeTarget "Pods-Example" */; 254 | buildPhases = ( 255 | 3C69E3330FF45E8EC70572AA79D8530A /* Headers */, 256 | CD6E65E2820BF66C80EF45C7B196D4F1 /* Sources */, 257 | 079F8F9DE057C06138CF487A55AD8E2C /* Frameworks */, 258 | 28BBF81EEDD7CF41E7EBACB25D19C367 /* Resources */, 259 | ); 260 | buildRules = ( 261 | ); 262 | dependencies = ( 263 | D91CDDA31D19B8280C77805A444836FF /* PBXTargetDependency */, 264 | ); 265 | name = "Pods-Example"; 266 | productName = Pods_Example; 267 | productReference = 1F667CC0E19EAF34E5A4119E2121F585 /* Pods-Example */; 268 | productType = "com.apple.product-type.framework"; 269 | }; 270 | /* End PBXNativeTarget section */ 271 | 272 | /* Begin PBXProject section */ 273 | BFDFE7DC352907FC980B868725387E98 /* Project object */ = { 274 | isa = PBXProject; 275 | attributes = { 276 | LastSwiftUpdateCheck = 1240; 277 | LastUpgradeCheck = 1240; 278 | }; 279 | buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; 280 | compatibilityVersion = "Xcode 13.0"; 281 | developmentRegion = en; 282 | hasScannedForEncodings = 0; 283 | knownRegions = ( 284 | Base, 285 | en, 286 | ); 287 | mainGroup = CF1408CF629C7361332E53B88F7BD30C; 288 | productRefGroup = 3FBB470C8B386C76E330EBDAECEA671C /* Products */; 289 | projectDirPath = ""; 290 | projectRoot = ""; 291 | targets = ( 292 | 0AEE99A309977BD12A049FF48AF9BA4B /* Pods-Example */, 293 | 0795C0BFDFF80202A0DC79AF5B97EA98 /* SSMediaLibrary */, 294 | ); 295 | }; 296 | /* End PBXProject section */ 297 | 298 | /* Begin PBXResourcesBuildPhase section */ 299 | 28BBF81EEDD7CF41E7EBACB25D19C367 /* Resources */ = { 300 | isa = PBXResourcesBuildPhase; 301 | buildActionMask = 2147483647; 302 | files = ( 303 | ); 304 | runOnlyForDeploymentPostprocessing = 0; 305 | }; 306 | 6454381E51ACECDDD64CD925F594EBFF /* Resources */ = { 307 | isa = PBXResourcesBuildPhase; 308 | buildActionMask = 2147483647; 309 | files = ( 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | }; 313 | /* End PBXResourcesBuildPhase section */ 314 | 315 | /* Begin PBXSourcesBuildPhase section */ 316 | 23CB8445D7B5FD57D42300CF6096C646 /* Sources */ = { 317 | isa = PBXSourcesBuildPhase; 318 | buildActionMask = 2147483647; 319 | files = ( 320 | EFE0A6EA7EE235CF40A3EEC6069F1652 /* MediaManager.swift in Sources */, 321 | 6CBD4C98BC8042A339063B072E6D6874 /* NetworkManager.swift in Sources */, 322 | C83B7B22CCBA4311546A984BD214CE69 /* SSMediaLibrary-dummy.m in Sources */, 323 | B402F83B7461667F4E394D1B52B76159 /* UTI.swift in Sources */, 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | CD6E65E2820BF66C80EF45C7B196D4F1 /* Sources */ = { 328 | isa = PBXSourcesBuildPhase; 329 | buildActionMask = 2147483647; 330 | files = ( 331 | 7F81B2E107AC0243DA7EA6EF2C9DE36D /* Pods-Example-dummy.m in Sources */, 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | /* End PBXSourcesBuildPhase section */ 336 | 337 | /* Begin PBXTargetDependency section */ 338 | D91CDDA31D19B8280C77805A444836FF /* PBXTargetDependency */ = { 339 | isa = PBXTargetDependency; 340 | name = SSMediaLibrary; 341 | target = 0795C0BFDFF80202A0DC79AF5B97EA98 /* SSMediaLibrary */; 342 | targetProxy = DA41B6F0479B0918694BA200EEB44AC0 /* PBXContainerItemProxy */; 343 | }; 344 | /* End PBXTargetDependency section */ 345 | 346 | /* Begin XCBuildConfiguration section */ 347 | 4BC7450F9457737EE3E637BA155B56F7 /* Debug */ = { 348 | isa = XCBuildConfiguration; 349 | buildSettings = { 350 | ALWAYS_SEARCH_USER_PATHS = NO; 351 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 352 | CLANG_ANALYZER_NONNULL = YES; 353 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 354 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 355 | CLANG_CXX_LIBRARY = "libc++"; 356 | CLANG_ENABLE_MODULES = YES; 357 | CLANG_ENABLE_OBJC_ARC = YES; 358 | CLANG_ENABLE_OBJC_WEAK = YES; 359 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 360 | CLANG_WARN_BOOL_CONVERSION = YES; 361 | CLANG_WARN_COMMA = YES; 362 | CLANG_WARN_CONSTANT_CONVERSION = YES; 363 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 364 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 365 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 366 | CLANG_WARN_EMPTY_BODY = YES; 367 | CLANG_WARN_ENUM_CONVERSION = YES; 368 | CLANG_WARN_INFINITE_RECURSION = YES; 369 | CLANG_WARN_INT_CONVERSION = YES; 370 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 371 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 372 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 373 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 374 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 375 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 376 | CLANG_WARN_STRICT_PROTOTYPES = YES; 377 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 378 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 379 | CLANG_WARN_UNREACHABLE_CODE = YES; 380 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 381 | COPY_PHASE_STRIP = NO; 382 | DEBUG_INFORMATION_FORMAT = dwarf; 383 | ENABLE_STRICT_OBJC_MSGSEND = YES; 384 | ENABLE_TESTABILITY = YES; 385 | GCC_C_LANGUAGE_STANDARD = gnu11; 386 | GCC_DYNAMIC_NO_PIC = NO; 387 | GCC_NO_COMMON_BLOCKS = YES; 388 | GCC_OPTIMIZATION_LEVEL = 0; 389 | GCC_PREPROCESSOR_DEFINITIONS = ( 390 | "POD_CONFIGURATION_DEBUG=1", 391 | "DEBUG=1", 392 | "$(inherited)", 393 | ); 394 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 395 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 396 | GCC_WARN_UNDECLARED_SELECTOR = YES; 397 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 398 | GCC_WARN_UNUSED_FUNCTION = YES; 399 | GCC_WARN_UNUSED_VARIABLE = YES; 400 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 401 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 402 | MTL_FAST_MATH = YES; 403 | ONLY_ACTIVE_ARCH = YES; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | STRIP_INSTALLED_PRODUCT = NO; 406 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 407 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 408 | SWIFT_VERSION = 5.0; 409 | SYMROOT = "${SRCROOT}/../build"; 410 | }; 411 | name = Debug; 412 | }; 413 | 8B5A46FF8D3C1289CDEE3BAFACABCD2A /* Release */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | ALWAYS_SEARCH_USER_PATHS = NO; 417 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 418 | CLANG_ANALYZER_NONNULL = YES; 419 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 420 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 421 | CLANG_CXX_LIBRARY = "libc++"; 422 | CLANG_ENABLE_MODULES = YES; 423 | CLANG_ENABLE_OBJC_ARC = YES; 424 | CLANG_ENABLE_OBJC_WEAK = YES; 425 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 426 | CLANG_WARN_BOOL_CONVERSION = YES; 427 | CLANG_WARN_COMMA = YES; 428 | CLANG_WARN_CONSTANT_CONVERSION = YES; 429 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 430 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 431 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 432 | CLANG_WARN_EMPTY_BODY = YES; 433 | CLANG_WARN_ENUM_CONVERSION = YES; 434 | CLANG_WARN_INFINITE_RECURSION = YES; 435 | CLANG_WARN_INT_CONVERSION = YES; 436 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 437 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 438 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 439 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 440 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 441 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 442 | CLANG_WARN_STRICT_PROTOTYPES = YES; 443 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 444 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 445 | CLANG_WARN_UNREACHABLE_CODE = YES; 446 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 447 | COPY_PHASE_STRIP = NO; 448 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 449 | ENABLE_NS_ASSERTIONS = NO; 450 | ENABLE_STRICT_OBJC_MSGSEND = YES; 451 | GCC_C_LANGUAGE_STANDARD = gnu11; 452 | GCC_NO_COMMON_BLOCKS = YES; 453 | GCC_PREPROCESSOR_DEFINITIONS = ( 454 | "POD_CONFIGURATION_RELEASE=1", 455 | "$(inherited)", 456 | ); 457 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 458 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 459 | GCC_WARN_UNDECLARED_SELECTOR = YES; 460 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 461 | GCC_WARN_UNUSED_FUNCTION = YES; 462 | GCC_WARN_UNUSED_VARIABLE = YES; 463 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 464 | MTL_ENABLE_DEBUG_INFO = NO; 465 | MTL_FAST_MATH = YES; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | STRIP_INSTALLED_PRODUCT = NO; 468 | SWIFT_COMPILATION_MODE = wholemodule; 469 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 470 | SWIFT_VERSION = 5.0; 471 | SYMROOT = "${SRCROOT}/../build"; 472 | }; 473 | name = Release; 474 | }; 475 | 912EF96166F0BC564C634727310B16CF /* Release */ = { 476 | isa = XCBuildConfiguration; 477 | baseConfigurationReference = DF23B3112FF8B45C9B44AC2AC5261E46 /* SSMediaLibrary.release.xcconfig */; 478 | buildSettings = { 479 | CLANG_ENABLE_OBJC_WEAK = NO; 480 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 481 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 482 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 483 | CURRENT_PROJECT_VERSION = 1; 484 | DEFINES_MODULE = YES; 485 | DYLIB_COMPATIBILITY_VERSION = 1; 486 | DYLIB_CURRENT_VERSION = 1; 487 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 488 | GCC_PREFIX_HEADER = "Target Support Files/SSMediaLibrary/SSMediaLibrary-prefix.pch"; 489 | INFOPLIST_FILE = "Target Support Files/SSMediaLibrary/SSMediaLibrary-Info.plist"; 490 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 491 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 492 | LD_RUNPATH_SEARCH_PATHS = ( 493 | "$(inherited)", 494 | "@executable_path/Frameworks", 495 | "@loader_path/Frameworks", 496 | ); 497 | MODULEMAP_FILE = "Target Support Files/SSMediaLibrary/SSMediaLibrary.modulemap"; 498 | PRODUCT_MODULE_NAME = SSMediaLibrary; 499 | PRODUCT_NAME = SSMediaLibrary; 500 | SDKROOT = iphoneos; 501 | SKIP_INSTALL = YES; 502 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; 503 | SWIFT_VERSION = 5.0; 504 | TARGETED_DEVICE_FAMILY = "1,2"; 505 | VALIDATE_PRODUCT = YES; 506 | VERSIONING_SYSTEM = "apple-generic"; 507 | VERSION_INFO_PREFIX = ""; 508 | }; 509 | name = Release; 510 | }; 511 | 969AC359EDF7E04C9AAE39A224440259 /* Debug */ = { 512 | isa = XCBuildConfiguration; 513 | baseConfigurationReference = 3A69D38064CD51E23BB05FF36F1F0523 /* SSMediaLibrary.debug.xcconfig */; 514 | buildSettings = { 515 | CLANG_ENABLE_OBJC_WEAK = NO; 516 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 517 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 518 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 519 | CURRENT_PROJECT_VERSION = 1; 520 | DEFINES_MODULE = YES; 521 | DYLIB_COMPATIBILITY_VERSION = 1; 522 | DYLIB_CURRENT_VERSION = 1; 523 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 524 | GCC_PREFIX_HEADER = "Target Support Files/SSMediaLibrary/SSMediaLibrary-prefix.pch"; 525 | INFOPLIST_FILE = "Target Support Files/SSMediaLibrary/SSMediaLibrary-Info.plist"; 526 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 527 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 528 | LD_RUNPATH_SEARCH_PATHS = ( 529 | "$(inherited)", 530 | "@executable_path/Frameworks", 531 | "@loader_path/Frameworks", 532 | ); 533 | MODULEMAP_FILE = "Target Support Files/SSMediaLibrary/SSMediaLibrary.modulemap"; 534 | PRODUCT_MODULE_NAME = SSMediaLibrary; 535 | PRODUCT_NAME = SSMediaLibrary; 536 | SDKROOT = iphoneos; 537 | SKIP_INSTALL = YES; 538 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; 539 | SWIFT_VERSION = 5.0; 540 | TARGETED_DEVICE_FAMILY = "1,2"; 541 | VERSIONING_SYSTEM = "apple-generic"; 542 | VERSION_INFO_PREFIX = ""; 543 | }; 544 | name = Debug; 545 | }; 546 | D3D1ED9408C0EFDBACACE95850437959 /* Debug */ = { 547 | isa = XCBuildConfiguration; 548 | baseConfigurationReference = B45138496B85A072654D1D0F8EBBEDE5 /* Pods-Example.debug.xcconfig */; 549 | buildSettings = { 550 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; 551 | CLANG_ENABLE_OBJC_WEAK = NO; 552 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 553 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 554 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 555 | CURRENT_PROJECT_VERSION = 1; 556 | DEFINES_MODULE = YES; 557 | DYLIB_COMPATIBILITY_VERSION = 1; 558 | DYLIB_CURRENT_VERSION = 1; 559 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 560 | INFOPLIST_FILE = "Target Support Files/Pods-Example/Pods-Example-Info.plist"; 561 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 562 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 563 | LD_RUNPATH_SEARCH_PATHS = ( 564 | "$(inherited)", 565 | "@executable_path/Frameworks", 566 | "@loader_path/Frameworks", 567 | ); 568 | MACH_O_TYPE = staticlib; 569 | MODULEMAP_FILE = "Target Support Files/Pods-Example/Pods-Example.modulemap"; 570 | OTHER_LDFLAGS = ""; 571 | OTHER_LIBTOOLFLAGS = ""; 572 | PODS_ROOT = "$(SRCROOT)"; 573 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 574 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 575 | SDKROOT = iphoneos; 576 | SKIP_INSTALL = YES; 577 | TARGETED_DEVICE_FAMILY = "1,2"; 578 | VERSIONING_SYSTEM = "apple-generic"; 579 | VERSION_INFO_PREFIX = ""; 580 | }; 581 | name = Debug; 582 | }; 583 | D673C3E7E106A54DDD5F899709AA4781 /* Release */ = { 584 | isa = XCBuildConfiguration; 585 | baseConfigurationReference = 243410B9535472556EA4BB6DBC133A0D /* Pods-Example.release.xcconfig */; 586 | buildSettings = { 587 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; 588 | CLANG_ENABLE_OBJC_WEAK = NO; 589 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 590 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 591 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 592 | CURRENT_PROJECT_VERSION = 1; 593 | DEFINES_MODULE = YES; 594 | DYLIB_COMPATIBILITY_VERSION = 1; 595 | DYLIB_CURRENT_VERSION = 1; 596 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 597 | INFOPLIST_FILE = "Target Support Files/Pods-Example/Pods-Example-Info.plist"; 598 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 599 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 600 | LD_RUNPATH_SEARCH_PATHS = ( 601 | "$(inherited)", 602 | "@executable_path/Frameworks", 603 | "@loader_path/Frameworks", 604 | ); 605 | MACH_O_TYPE = staticlib; 606 | MODULEMAP_FILE = "Target Support Files/Pods-Example/Pods-Example.modulemap"; 607 | OTHER_LDFLAGS = ""; 608 | OTHER_LIBTOOLFLAGS = ""; 609 | PODS_ROOT = "$(SRCROOT)"; 610 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 611 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 612 | SDKROOT = iphoneos; 613 | SKIP_INSTALL = YES; 614 | TARGETED_DEVICE_FAMILY = "1,2"; 615 | VALIDATE_PRODUCT = YES; 616 | VERSIONING_SYSTEM = "apple-generic"; 617 | VERSION_INFO_PREFIX = ""; 618 | }; 619 | name = Release; 620 | }; 621 | /* End XCBuildConfiguration section */ 622 | 623 | /* Begin XCConfigurationList section */ 624 | 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { 625 | isa = XCConfigurationList; 626 | buildConfigurations = ( 627 | 4BC7450F9457737EE3E637BA155B56F7 /* Debug */, 628 | 8B5A46FF8D3C1289CDEE3BAFACABCD2A /* Release */, 629 | ); 630 | defaultConfigurationIsVisible = 0; 631 | defaultConfigurationName = Release; 632 | }; 633 | BA98B4318A10023517E5B80E41F0FBEA /* Build configuration list for PBXNativeTarget "SSMediaLibrary" */ = { 634 | isa = XCConfigurationList; 635 | buildConfigurations = ( 636 | 969AC359EDF7E04C9AAE39A224440259 /* Debug */, 637 | 912EF96166F0BC564C634727310B16CF /* Release */, 638 | ); 639 | defaultConfigurationIsVisible = 0; 640 | defaultConfigurationName = Release; 641 | }; 642 | E141379FAE3449D6CB8755EFA08CD315 /* Build configuration list for PBXNativeTarget "Pods-Example" */ = { 643 | isa = XCConfigurationList; 644 | buildConfigurations = ( 645 | D3D1ED9408C0EFDBACACE95850437959 /* Debug */, 646 | D673C3E7E106A54DDD5F899709AA4781 /* Release */, 647 | ); 648 | defaultConfigurationIsVisible = 0; 649 | defaultConfigurationName = Release; 650 | }; 651 | /* End XCConfigurationList section */ 652 | }; 653 | rootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */; 654 | } 655 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-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 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks-Debug-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/SSMediaLibrary/SSMediaLibrary.framework -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks-Debug-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSMediaLibrary.framework -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks-Release-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/SSMediaLibrary/SSMediaLibrary.framework -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks-Release-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSMediaLibrary.framework -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | BCSYMBOLMAP_DIR="BCSymbolMaps" 23 | 24 | 25 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 26 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 27 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 28 | 29 | # Copies and strips a vendored framework 30 | install_framework() 31 | { 32 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 33 | local source="${BUILT_PRODUCTS_DIR}/$1" 34 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 35 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 36 | elif [ -r "$1" ]; then 37 | local source="$1" 38 | fi 39 | 40 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 41 | 42 | if [ -L "${source}" ]; then 43 | echo "Symlinked..." 44 | source="$(readlink "${source}")" 45 | fi 46 | 47 | if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then 48 | # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied 49 | find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do 50 | echo "Installing $f" 51 | install_bcsymbolmap "$f" "$destination" 52 | rm "$f" 53 | done 54 | rmdir "${source}/${BCSYMBOLMAP_DIR}" 55 | fi 56 | 57 | # Use filter instead of exclude so missing patterns don't throw errors. 58 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 59 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 60 | 61 | local basename 62 | basename="$(basename -s .framework "$1")" 63 | binary="${destination}/${basename}.framework/${basename}" 64 | 65 | if ! [ -r "$binary" ]; then 66 | binary="${destination}/${basename}" 67 | elif [ -L "${binary}" ]; then 68 | echo "Destination binary is symlinked..." 69 | dirname="$(dirname "${binary}")" 70 | binary="${dirname}/$(readlink "${binary}")" 71 | fi 72 | 73 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 74 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 75 | strip_invalid_archs "$binary" 76 | fi 77 | 78 | # Resign the code if required by the build settings to avoid unstable apps 79 | code_sign_if_enabled "${destination}/$(basename "$1")" 80 | 81 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 82 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 83 | local swift_runtime_libs 84 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 85 | for lib in $swift_runtime_libs; do 86 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 87 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 88 | code_sign_if_enabled "${destination}/${lib}" 89 | done 90 | fi 91 | } 92 | # Copies and strips a vendored dSYM 93 | install_dsym() { 94 | local source="$1" 95 | warn_missing_arch=${2:-true} 96 | if [ -r "$source" ]; then 97 | # Copy the dSYM into the targets temp dir. 98 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 99 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 100 | 101 | local basename 102 | basename="$(basename -s .dSYM "$source")" 103 | binary_name="$(ls "$source/Contents/Resources/DWARF")" 104 | binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" 105 | 106 | # Strip invalid architectures from the dSYM. 107 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 108 | strip_invalid_archs "$binary" "$warn_missing_arch" 109 | fi 110 | if [[ $STRIP_BINARY_RETVAL == 0 ]]; then 111 | # Move the stripped file into its final destination. 112 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 113 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 114 | else 115 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 116 | mkdir -p "${DWARF_DSYM_FOLDER_PATH}" 117 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" 118 | fi 119 | fi 120 | } 121 | 122 | # Used as a return value for each invocation of `strip_invalid_archs` function. 123 | STRIP_BINARY_RETVAL=0 124 | 125 | # Strip invalid architectures 126 | strip_invalid_archs() { 127 | binary="$1" 128 | warn_missing_arch=${2:-true} 129 | # Get architectures for current target binary 130 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 131 | # Intersect them with the architectures we are building for 132 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 133 | # If there are no archs supported by this binary then warn the user 134 | if [[ -z "$intersected_archs" ]]; then 135 | if [[ "$warn_missing_arch" == "true" ]]; then 136 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 137 | fi 138 | STRIP_BINARY_RETVAL=1 139 | return 140 | fi 141 | stripped="" 142 | for arch in $binary_archs; do 143 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 144 | # Strip non-valid architectures in-place 145 | lipo -remove "$arch" -output "$binary" "$binary" 146 | stripped="$stripped $arch" 147 | fi 148 | done 149 | if [[ "$stripped" ]]; then 150 | echo "Stripped $binary of architectures:$stripped" 151 | fi 152 | STRIP_BINARY_RETVAL=0 153 | } 154 | 155 | # Copies the bcsymbolmap files of a vendored framework 156 | install_bcsymbolmap() { 157 | local bcsymbolmap_path="$1" 158 | local destination="${BUILT_PRODUCTS_DIR}" 159 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 160 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 161 | } 162 | 163 | # Signs a framework with the provided identity 164 | code_sign_if_enabled() { 165 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 166 | # Use the current code_sign_identity 167 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 168 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 169 | 170 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 171 | code_sign_cmd="$code_sign_cmd &" 172 | fi 173 | echo "$code_sign_cmd" 174 | eval "$code_sign_cmd" 175 | fi 176 | } 177 | 178 | if [[ "$CONFIGURATION" == "Debug" ]]; then 179 | install_framework "${BUILT_PRODUCTS_DIR}/SSMediaLibrary/SSMediaLibrary.framework" 180 | fi 181 | if [[ "$CONFIGURATION" == "Release" ]]; then 182 | install_framework "${BUILT_PRODUCTS_DIR}/SSMediaLibrary/SSMediaLibrary.framework" 183 | fi 184 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 185 | wait 186 | fi 187 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SSMediaLibrary" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SSMediaLibrary/SSMediaLibrary.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 8 | OTHER_LDFLAGS = $(inherited) -framework "SSMediaLibrary" -framework "UIKit" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Example { 2 | umbrella header "Pods-Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SSMediaLibrary" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SSMediaLibrary/SSMediaLibrary.framework/Headers" 6 | LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' 7 | LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 8 | OTHER_LDFLAGS = $(inherited) -framework "SSMediaLibrary" -framework "UIKit" 9 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 10 | PODS_BUILD_DIR = ${BUILD_DIR} 11 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 12 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 13 | PODS_ROOT = ${SRCROOT}/Pods 14 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SSMediaLibrary/SSMediaLibrary-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.8 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SSMediaLibrary/SSMediaLibrary-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SSMediaLibrary : NSObject 3 | @end 4 | @implementation PodsDummy_SSMediaLibrary 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SSMediaLibrary/SSMediaLibrary-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SSMediaLibrary/SSMediaLibrary-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "SSMediaLibraryHeader.h" 14 | 15 | FOUNDATION_EXPORT double SSMediaLibraryVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char SSMediaLibraryVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SSMediaLibrary/SSMediaLibrary.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SSMediaLibrary 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 5 | OTHER_LDFLAGS = $(inherited) -framework "UIKit" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT} 10 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 11 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 12 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 13 | SKIP_INSTALL = YES 14 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 15 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SSMediaLibrary/SSMediaLibrary.modulemap: -------------------------------------------------------------------------------- 1 | framework module SSMediaLibrary { 2 | umbrella header "SSMediaLibrary-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SSMediaLibrary/SSMediaLibrary.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SSMediaLibrary 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift 5 | OTHER_LDFLAGS = $(inherited) -framework "UIKit" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT} 10 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 11 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 12 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 13 | SKIP_INSTALL = YES 14 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 15 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "SSMediaLibrary", 8 | platforms: [.iOS(.v13)], 9 | products: [ 10 | // Products define the executables and libraries a package produces, and make them visible to other packages. 11 | .library( 12 | name: "SSMediaLibrary", 13 | targets: ["SSMediaLibrary"]), 14 | ], 15 | dependencies: [ 16 | // Dependencies declare other packages that this package depends on. 17 | // .package(url: /* package url */, from: "1.0.0"), 18 | ], 19 | targets: [ 20 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 21 | // Targets can depend on other targets in this package, and on products in packages this package depends on. 22 | .target( 23 | name: "SSMediaLibrary", 24 | dependencies: []), 25 | .testTarget( 26 | name: "SSMediaLibraryTests", 27 | dependencies: ["SSMediaLibrary"]), 28 | ], 29 | swiftLanguageVersions: [.v5] 30 | ) 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | SSMediaLibrary 4 | ============= 5 | [![CocoaPods Version](https://img.shields.io/cocoapods/v/SSMediaLibrary.svg)](http://cocoadocs.org/docsets/SSMediaLibrary) 6 | [![Platform](https://img.shields.io/cocoapods/p/SSMediaLibrary.svg?style=flat)](http://cocoapods.org/pods/SSMediaLibrary) 7 | [![License](https://img.shields.io/cocoapods/l/SSMediaLibrary.svg?style=flat)](https://cocoapods.org/pods/SSMediaLibrary) 8 | [![Swift Version][swift-image]][swift-url] 9 | [![PRs Welcome][PR-image]][PR-url] 10 | [![Twitter](https://img.shields.io/badge/Twitter-@simform-blue.svg?style=flat)](https://twitter.com/simform) 11 | 12 | SSMediaLibrary is written in Swift with the use of Combine framework. It will download and open up following files: 13 | * iWork documents 14 | * Microsoft Office documents (Office ‘97 and newer) 15 | * Rich Text Format (RTF) documents 16 | * PDF files 17 | * Images 18 | * Text files whose uniform type identifier (UTI) conforms to the public.text type 19 | * Comma-separated value (csv) files 20 | * Video 21 | * Any URL 22 | 23 |
24 | 25 | Setup Instructions 26 | ------------------ 27 | [CocoaPods](http://cocoapods.org) 28 | ------------------ 29 | To integrate SSMediaLibrary into your Xcode project using CocoaPods, specify it in your `Podfile`: 30 | ```ruby 31 | pod 'SSMediaLibrary', '~> 1.0.0' 32 | ``` 33 | and in your code add `import SSMediaLibrary`. 34 | 35 | [Swift Package Manager](https://swift.org/package-manager/) 36 | ------------------ 37 | When using Xcode 11 or later, you can install `SSMediaLibrary` by going to your Project settings > `Swift Packages` and add the repository by providing the GitHub URL. Alternatively, you can go to `File` > `Swift Packages` > `Add Package Dependencies...` 38 | 39 | ## Manually 40 | 41 | 1. Add `MediaManager.swift`, `NetworkManager.swift` and `UTI.swift` to your project. 42 | 2. Grab yourself a cold 🍺. 43 | 44 | ## Requirements 45 | * iOS 13+ 46 | * Xcode 11+ 47 | 48 | # Usage 49 | 1. Just provide URL to the MediaManager 50 | 2. Call the show function of MediaManager 51 | 52 | Basic Examples 53 | --------- 54 | ```swift 55 | guard let url = URL(string: "http://www.africau.edu/images/default/sample.pdf") else { return } 56 | let manager = MediaManager(url: url) 57 | manager.show() 58 | 59 | guard let url = URL(string: "https://file-examples-com.github.io/uploads/2017/10/file_example_JPG_100kB.jpg") else { return } 60 | let manager = MediaManager(url: url) 61 | manager.show() 62 | 63 | guard let url = URL(string: "https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mov-file.mov") else { return } 64 | let manager = MediaManager(url: url) 65 | manager.show() 66 | ``` 67 | # To-Do 68 | * Show file downloading progress 69 | * Support for other file 70 | 71 |

🗂 Check out our other libraries→

72 | 73 | 74 | ## MIT License 75 | 76 | Copyright (c) 2021 Simform Solutions 77 | 78 | Permission is hereby granted, free of charge, to any person obtaining a copy 79 | of this software and associated documentation files (the "Software"), to deal 80 | in the Software without restriction, including without limitation the rights 81 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 82 | copies of the Software, and to permit persons to whom the Software is 83 | furnished to do so, subject to the following conditions: 84 | 85 | The above copyright notice and this permission notice shall be included in all 86 | copies or substantial portions of the Software. 87 | 88 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 89 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 90 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 91 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER 92 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 93 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 94 | SOFTWARE. 95 | 96 | [PR-image]:https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat 97 | [PR-url]:http://makeapullrequest.com 98 | [swift-image]:https://img.shields.io/badge/swift-5.0-orange.svg 99 | [swift-url]: https://swift.org/ 100 | -------------------------------------------------------------------------------- /SSMediaLibrary.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.platform = :ios 4 | s.ios.deployment_target = '13.0' 5 | s.name = "SSMediaLibrary" 6 | s.summary = "SSMediaLibrary lets a user open any file" 7 | 8 | s.version = "1.0.0" 9 | 10 | s.license = { :type => "MIT", :file => "LICENSE" } 11 | 12 | s.author = { "Devansh Vyas" => "devansh.v@simformsolutions.com" } 13 | 14 | s.homepage = "https://github.com/mobile-simformsolutions/SSMediaLibrary" 15 | 16 | s.source = { :git => "https://github.com/mobile-simformsolutions/SSMediaLibrary.git", 17 | :tag => "#{s.version}" } 18 | 19 | s.framework = "UIKit" 20 | 21 | s.source_files = "SSMediaLibrary/**/*.{h,m,swift}" 22 | 23 | s.swift_version = "5.0" 24 | 25 | end 26 | -------------------------------------------------------------------------------- /SSMediaLibrary.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 53; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1A818A032704D2AA00FB3602 /* SSMediaLibraryHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A818A022704D2AA00FB3602 /* SSMediaLibraryHeader.h */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXFileReference section */ 14 | 1A03A494270338BF00A68A5B /* SSMediaLibrary.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SSMediaLibrary.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 15 | 1A6B0D0F26A1567B00D410EA /* SSMediaLibrary.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SSMediaLibrary.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 16 | 1A818A022704D2AA00FB3602 /* SSMediaLibraryHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SSMediaLibraryHeader.h; path = SSMediaLibrary/SSMediaLibraryHeader.h; sourceTree = ""; }; 17 | 1A818A042704D2BA00FB3602 /* Classes */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Classes; path = SSMediaLibrary/SSMediaLibrary.docc/Classes; sourceTree = ""; }; 18 | 1A818A052704D2C800FB3602 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 19 | 1A9AA6F027036590004F7942 /* Package.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 20 | /* End PBXFileReference section */ 21 | 22 | /* Begin PBXFrameworksBuildPhase section */ 23 | 1A6B0D0C26A1567B00D410EA /* Frameworks */ = { 24 | isa = PBXFrameworksBuildPhase; 25 | buildActionMask = 2147483647; 26 | files = ( 27 | ); 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXFrameworksBuildPhase section */ 31 | 32 | /* Begin PBXGroup section */ 33 | 1A6B0D0526A1567B00D410EA = { 34 | isa = PBXGroup; 35 | children = ( 36 | 1A9AA6F027036590004F7942 /* Package.swift */, 37 | 1A818A052704D2C800FB3602 /* README.md */, 38 | 1A03A494270338BF00A68A5B /* SSMediaLibrary.podspec */, 39 | 1A6B0D1126A1567B00D410EA /* SSMediaLibrary */, 40 | 1A6B0D1026A1567B00D410EA /* Products */, 41 | ); 42 | sourceTree = ""; 43 | }; 44 | 1A6B0D1026A1567B00D410EA /* Products */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | 1A6B0D0F26A1567B00D410EA /* SSMediaLibrary.framework */, 48 | ); 49 | name = Products; 50 | sourceTree = ""; 51 | }; 52 | 1A6B0D1126A1567B00D410EA /* SSMediaLibrary */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 1A818A022704D2AA00FB3602 /* SSMediaLibraryHeader.h */, 56 | 1A818A042704D2BA00FB3602 /* Classes */, 57 | ); 58 | path = SSMediaLibrary; 59 | sourceTree = ""; 60 | }; 61 | /* End PBXGroup section */ 62 | 63 | /* Begin PBXHeadersBuildPhase section */ 64 | 1A6B0D0A26A1567B00D410EA /* Headers */ = { 65 | isa = PBXHeadersBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 1A818A032704D2AA00FB3602 /* SSMediaLibraryHeader.h in Headers */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | /* End PBXHeadersBuildPhase section */ 73 | 74 | /* Begin PBXNativeTarget section */ 75 | 1A6B0D0E26A1567B00D410EA /* SSMediaLibrary */ = { 76 | isa = PBXNativeTarget; 77 | buildConfigurationList = 1A6B0D1826A1567B00D410EA /* Build configuration list for PBXNativeTarget "SSMediaLibrary" */; 78 | buildPhases = ( 79 | 1A6B0D0A26A1567B00D410EA /* Headers */, 80 | 1A6B0D0B26A1567B00D410EA /* Sources */, 81 | 1A6B0D0C26A1567B00D410EA /* Frameworks */, 82 | ); 83 | buildRules = ( 84 | ); 85 | dependencies = ( 86 | ); 87 | name = SSMediaLibrary; 88 | productName = SSMediaLibrary; 89 | productReference = 1A6B0D0F26A1567B00D410EA /* SSMediaLibrary.framework */; 90 | productType = "com.apple.product-type.framework"; 91 | }; 92 | /* End PBXNativeTarget section */ 93 | 94 | /* Begin PBXProject section */ 95 | 1A6B0D0626A1567B00D410EA /* Project object */ = { 96 | isa = PBXProject; 97 | attributes = { 98 | BuildIndependentTargetsInParallel = 1; 99 | LastUpgradeCheck = 1300; 100 | TargetAttributes = { 101 | 1A6B0D0E26A1567B00D410EA = { 102 | CreatedOnToolsVersion = 13.0; 103 | }; 104 | }; 105 | }; 106 | buildConfigurationList = 1A6B0D0926A1567B00D410EA /* Build configuration list for PBXProject "SSMediaLibrary" */; 107 | compatibilityVersion = "Xcode 11.0"; 108 | developmentRegion = en; 109 | hasScannedForEncodings = 0; 110 | knownRegions = ( 111 | en, 112 | Base, 113 | ); 114 | mainGroup = 1A6B0D0526A1567B00D410EA; 115 | productRefGroup = 1A6B0D1026A1567B00D410EA /* Products */; 116 | projectDirPath = ""; 117 | projectRoot = ""; 118 | targets = ( 119 | 1A6B0D0E26A1567B00D410EA /* SSMediaLibrary */, 120 | ); 121 | }; 122 | /* End PBXProject section */ 123 | 124 | /* Begin PBXSourcesBuildPhase section */ 125 | 1A6B0D0B26A1567B00D410EA /* Sources */ = { 126 | isa = PBXSourcesBuildPhase; 127 | buildActionMask = 2147483647; 128 | files = ( 129 | ); 130 | runOnlyForDeploymentPostprocessing = 0; 131 | }; 132 | /* End PBXSourcesBuildPhase section */ 133 | 134 | /* Begin XCBuildConfiguration section */ 135 | 1A6B0D1626A1567B00D410EA /* Debug */ = { 136 | isa = XCBuildConfiguration; 137 | buildSettings = { 138 | ALWAYS_SEARCH_USER_PATHS = NO; 139 | CLANG_ANALYZER_NONNULL = YES; 140 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 141 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 142 | CLANG_CXX_LIBRARY = "libc++"; 143 | CLANG_ENABLE_MODULES = YES; 144 | CLANG_ENABLE_OBJC_ARC = YES; 145 | CLANG_ENABLE_OBJC_WEAK = YES; 146 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 147 | CLANG_WARN_BOOL_CONVERSION = YES; 148 | CLANG_WARN_COMMA = YES; 149 | CLANG_WARN_CONSTANT_CONVERSION = YES; 150 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 151 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 152 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 153 | CLANG_WARN_EMPTY_BODY = YES; 154 | CLANG_WARN_ENUM_CONVERSION = YES; 155 | CLANG_WARN_INFINITE_RECURSION = YES; 156 | CLANG_WARN_INT_CONVERSION = YES; 157 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 158 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 159 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 160 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 161 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 162 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 163 | CLANG_WARN_STRICT_PROTOTYPES = YES; 164 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 165 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 166 | CLANG_WARN_UNREACHABLE_CODE = YES; 167 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 168 | COPY_PHASE_STRIP = NO; 169 | CURRENT_PROJECT_VERSION = 1; 170 | DEBUG_INFORMATION_FORMAT = dwarf; 171 | ENABLE_STRICT_OBJC_MSGSEND = YES; 172 | ENABLE_TESTABILITY = YES; 173 | GCC_C_LANGUAGE_STANDARD = gnu11; 174 | GCC_DYNAMIC_NO_PIC = NO; 175 | GCC_NO_COMMON_BLOCKS = YES; 176 | GCC_OPTIMIZATION_LEVEL = 0; 177 | GCC_PREPROCESSOR_DEFINITIONS = ( 178 | "DEBUG=1", 179 | "$(inherited)", 180 | ); 181 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 182 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 183 | GCC_WARN_UNDECLARED_SELECTOR = YES; 184 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 185 | GCC_WARN_UNUSED_FUNCTION = YES; 186 | GCC_WARN_UNUSED_VARIABLE = YES; 187 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 188 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 189 | MTL_FAST_MATH = YES; 190 | ONLY_ACTIVE_ARCH = YES; 191 | SDKROOT = iphoneos; 192 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 193 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 194 | VERSIONING_SYSTEM = "apple-generic"; 195 | VERSION_INFO_PREFIX = ""; 196 | }; 197 | name = Debug; 198 | }; 199 | 1A6B0D1726A1567B00D410EA /* Release */ = { 200 | isa = XCBuildConfiguration; 201 | buildSettings = { 202 | ALWAYS_SEARCH_USER_PATHS = NO; 203 | CLANG_ANALYZER_NONNULL = YES; 204 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 205 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 206 | CLANG_CXX_LIBRARY = "libc++"; 207 | CLANG_ENABLE_MODULES = YES; 208 | CLANG_ENABLE_OBJC_ARC = YES; 209 | CLANG_ENABLE_OBJC_WEAK = YES; 210 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 211 | CLANG_WARN_BOOL_CONVERSION = YES; 212 | CLANG_WARN_COMMA = YES; 213 | CLANG_WARN_CONSTANT_CONVERSION = YES; 214 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 215 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 216 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INFINITE_RECURSION = YES; 220 | CLANG_WARN_INT_CONVERSION = YES; 221 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 222 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 223 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 224 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 225 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 226 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 227 | CLANG_WARN_STRICT_PROTOTYPES = YES; 228 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 229 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 230 | CLANG_WARN_UNREACHABLE_CODE = YES; 231 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 232 | COPY_PHASE_STRIP = NO; 233 | CURRENT_PROJECT_VERSION = 1; 234 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 235 | ENABLE_NS_ASSERTIONS = NO; 236 | ENABLE_STRICT_OBJC_MSGSEND = YES; 237 | GCC_C_LANGUAGE_STANDARD = gnu11; 238 | GCC_NO_COMMON_BLOCKS = YES; 239 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 240 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 241 | GCC_WARN_UNDECLARED_SELECTOR = YES; 242 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 243 | GCC_WARN_UNUSED_FUNCTION = YES; 244 | GCC_WARN_UNUSED_VARIABLE = YES; 245 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 246 | MTL_ENABLE_DEBUG_INFO = NO; 247 | MTL_FAST_MATH = YES; 248 | SDKROOT = iphoneos; 249 | SWIFT_COMPILATION_MODE = wholemodule; 250 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 251 | VALIDATE_PRODUCT = YES; 252 | VERSIONING_SYSTEM = "apple-generic"; 253 | VERSION_INFO_PREFIX = ""; 254 | }; 255 | name = Release; 256 | }; 257 | 1A6B0D1926A1567B00D410EA /* Debug */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | CODE_SIGN_STYLE = Automatic; 261 | CURRENT_PROJECT_VERSION = 1; 262 | DEFINES_MODULE = YES; 263 | DYLIB_COMPATIBILITY_VERSION = 1; 264 | DYLIB_CURRENT_VERSION = 1; 265 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 266 | GENERATE_INFOPLIST_FILE = YES; 267 | INFOPLIST_KEY_NSHumanReadableCopyright = ""; 268 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 269 | LD_RUNPATH_SEARCH_PATHS = ( 270 | "$(inherited)", 271 | "@executable_path/Frameworks", 272 | "@loader_path/Frameworks", 273 | ); 274 | MARKETING_VERSION = 1.0; 275 | PRODUCT_BUNDLE_IDENTIFIER = com.simformsolutions.SSMediaLibrary; 276 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 277 | SKIP_INSTALL = YES; 278 | SWIFT_EMIT_LOC_STRINGS = YES; 279 | SWIFT_VERSION = 5.0; 280 | TARGETED_DEVICE_FAMILY = "1,2"; 281 | }; 282 | name = Debug; 283 | }; 284 | 1A6B0D1A26A1567B00D410EA /* Release */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | CODE_SIGN_STYLE = Automatic; 288 | CURRENT_PROJECT_VERSION = 1; 289 | DEFINES_MODULE = YES; 290 | DYLIB_COMPATIBILITY_VERSION = 1; 291 | DYLIB_CURRENT_VERSION = 1; 292 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 293 | GENERATE_INFOPLIST_FILE = YES; 294 | INFOPLIST_KEY_NSHumanReadableCopyright = ""; 295 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 296 | LD_RUNPATH_SEARCH_PATHS = ( 297 | "$(inherited)", 298 | "@executable_path/Frameworks", 299 | "@loader_path/Frameworks", 300 | ); 301 | MARKETING_VERSION = 1.0; 302 | PRODUCT_BUNDLE_IDENTIFIER = com.simformsolutions.SSMediaLibrary; 303 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 304 | SKIP_INSTALL = YES; 305 | SWIFT_EMIT_LOC_STRINGS = YES; 306 | SWIFT_VERSION = 5.0; 307 | TARGETED_DEVICE_FAMILY = "1,2"; 308 | }; 309 | name = Release; 310 | }; 311 | /* End XCBuildConfiguration section */ 312 | 313 | /* Begin XCConfigurationList section */ 314 | 1A6B0D0926A1567B00D410EA /* Build configuration list for PBXProject "SSMediaLibrary" */ = { 315 | isa = XCConfigurationList; 316 | buildConfigurations = ( 317 | 1A6B0D1626A1567B00D410EA /* Debug */, 318 | 1A6B0D1726A1567B00D410EA /* Release */, 319 | ); 320 | defaultConfigurationIsVisible = 0; 321 | defaultConfigurationName = Release; 322 | }; 323 | 1A6B0D1826A1567B00D410EA /* Build configuration list for PBXNativeTarget "SSMediaLibrary" */ = { 324 | isa = XCConfigurationList; 325 | buildConfigurations = ( 326 | 1A6B0D1926A1567B00D410EA /* Debug */, 327 | 1A6B0D1A26A1567B00D410EA /* Release */, 328 | ); 329 | defaultConfigurationIsVisible = 0; 330 | defaultConfigurationName = Release; 331 | }; 332 | /* End XCConfigurationList section */ 333 | }; 334 | rootObject = 1A6B0D0626A1567B00D410EA /* Project object */; 335 | } 336 | -------------------------------------------------------------------------------- /SSMediaLibrary.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SSMediaLibrary.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SSMediaLibrary.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SSMediaLibrary.xcodeproj/xcshareddata/xcschemes/SSMediaLibrary.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /SSMediaLibrary/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | DerivedData/ 7 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 8 | -------------------------------------------------------------------------------- /SSMediaLibrary/SSMediaLibrary/SSMediaLibrary.docc/Classes/MediaManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MediaManager.swift 3 | // SSMediaLibrary 4 | // 5 | // Created by Devansh Vyas on 16/06/21. 6 | // 7 | 8 | import UIKit 9 | import Combine 10 | import QuickLook 11 | import AVKit 12 | import SafariServices 13 | 14 | public class MediaManager { 15 | var mediaUrl: URL? 16 | var mediaExtension: UTI? 17 | var sinkOperation: AnyCancellable? 18 | var localUrl: URL? 19 | 20 | weak var topVC: UIViewController? { 21 | guard var topController = UIApplication.shared.windows.first?.rootViewController 22 | else { return nil } 23 | 24 | while let presentedViewController = topController.presentedViewController { 25 | topController = presentedViewController 26 | } 27 | return topController 28 | } 29 | 30 | var isAudioVideo: Bool { 31 | guard let mediaExtension = mediaExtension else { 32 | return false 33 | } 34 | 35 | switch mediaExtension { 36 | case .audiovisualContent, .movie, .video, .audio, .quickTimeMovie, .mpeg, .mpeg2Video, .mpeg2TransportStream, 37 | .mp3, .mpeg4, .mpeg4Audio, .appleProtectedMPEG4Audio, .appleProtectedMPEG4Video, .aviMovie, 38 | .audioInterchangeFileFormat, .waveformAudio, .midiAudio, .playlist, .m3UPlaylist: 39 | return true 40 | default: 41 | return false 42 | } 43 | } 44 | 45 | public init(url: URL) { 46 | mediaUrl = url 47 | localUrl = url 48 | mediaExtension = UTI(withExtension: url.pathExtension) 49 | } 50 | 51 | public func show() { 52 | guard let mediaUrl = mediaUrl else { 53 | return 54 | } 55 | if let filePath = getFileFromLocal() { 56 | localUrl = filePath 57 | openFile() 58 | } else { 59 | if isAudioVideo { 60 | openVideoPlayer() 61 | } 62 | if mediaExtension != .html { 63 | downloadFile(url: mediaUrl) 64 | } 65 | } 66 | } 67 | 68 | func getFileFromLocal() -> URL? { 69 | guard let fileName = mediaUrl?.lastPathComponent, 70 | var documentDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first 71 | else { return nil } 72 | documentDir.appendPathComponent(fileName) 73 | return FileManager.default.fileExists(atPath: documentDir.path) ? URL(fileURLWithPath: documentDir.path) : nil 74 | } 75 | 76 | func downloadFile(url: URL) { 77 | sinkOperation = URLSession.shared 78 | .downloadTaskPublisher(for: url) 79 | .sink(receiveCompletion: { completion in 80 | print("Sink completion: \(completion)") 81 | }) { value in 82 | print("Sink value: \(value.url)") 83 | DispatchQueue.main.async { 84 | self.localUrl = value.url 85 | if !self.isAudioVideo { 86 | self.openFile() 87 | } 88 | } 89 | } 90 | } 91 | 92 | func openFile() { 93 | guard let mediaExtension = mediaExtension else { 94 | return 95 | } 96 | switch mediaExtension { 97 | case .html: 98 | openHtml() 99 | 100 | case .audiovisualContent, .movie, .video, .audio, .quickTimeMovie, .mpeg, .mpeg2Video, .mpeg2TransportStream, 101 | .mp3, .mpeg4, .mpeg4Audio, .appleProtectedMPEG4Audio, .appleProtectedMPEG4Video, .aviMovie, 102 | .audioInterchangeFileFormat, .waveformAudio, .midiAudio, .playlist, .m3UPlaylist: 103 | openVideoPlayer() 104 | 105 | default: 106 | openWithQuickLook() 107 | } 108 | } 109 | 110 | func openHtml() { 111 | guard let url = mediaUrl else { return } 112 | print("===>> \(url)") 113 | let vc = SFSafariViewController(url: url) 114 | topVC?.present(vc, animated: true) 115 | } 116 | 117 | func openVideoPlayer() { 118 | guard let localUrl = localUrl else { 119 | return 120 | } 121 | let player = AVPlayer(url: localUrl) 122 | let playerViewController = AVPlayerViewController() 123 | playerViewController.player = player 124 | topVC?.present(playerViewController, animated: true) { 125 | playerViewController.player?.play() 126 | } 127 | } 128 | 129 | func openWithQuickLook() { 130 | let previewController = QLPreviewController() 131 | previewController.dataSource = self 132 | topVC?.present(previewController, animated: true, completion: nil) 133 | } 134 | } 135 | 136 | extension MediaManager: QLPreviewControllerDataSource { 137 | public func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { 138 | print("===> \(String(describing: localUrl))") 139 | guard let url = localUrl else { 140 | fatalError() 141 | } 142 | return url as QLPreviewItem 143 | } 144 | 145 | public func numberOfPreviewItems(in controller: QLPreviewController) -> Int { 146 | return 1 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /SSMediaLibrary/SSMediaLibrary/SSMediaLibrary.docc/Classes/NetworkManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkManager.swift 3 | // SSMediaLibrary 4 | // 5 | // Created by Devansh Vyas on 16/06/21. 6 | // 7 | 8 | import Foundation 9 | import Combine 10 | 11 | class NetworkManager { 12 | static let shared = NetworkManager() 13 | var sinkOperation: AnyCancellable? 14 | 15 | func downloadFile(url: URL) { 16 | sinkOperation = URLSession.shared 17 | .downloadTaskPublisher(for: url) 18 | .sink(receiveCompletion: { completion in 19 | print("Sink completion: \(completion)") 20 | }) { value in 21 | print("Sink value: \(value.url)") 22 | } 23 | } 24 | } 25 | 26 | 27 | extension URLSession { 28 | public func downloadTaskPublisher(for url: URL) -> URLSession.DownloadTaskPublisher { 29 | self.downloadTaskPublisher(for: .init(url: url)) 30 | } 31 | 32 | public func downloadTaskPublisher(for request: URLRequest) -> URLSession.DownloadTaskPublisher { 33 | .init(request: request, session: self) 34 | } 35 | 36 | public struct DownloadTaskPublisher: Publisher { 37 | 38 | public typealias Output = (url: URL, response: URLResponse) 39 | public typealias Failure = URLError 40 | 41 | public let request: URLRequest 42 | public let session: URLSession 43 | 44 | public init(request: URLRequest, session: URLSession) { 45 | self.request = request 46 | self.session = session 47 | } 48 | 49 | public func receive(subscriber: S) where S: Subscriber, 50 | DownloadTaskPublisher.Failure == S.Failure, 51 | DownloadTaskPublisher.Output == S.Input 52 | { 53 | let subscription = DownloadTaskSubscription(subscriber: subscriber, session: self.session, request: self.request) 54 | subscriber.receive(subscription: subscription) 55 | } 56 | } 57 | } 58 | 59 | extension URLSession { 60 | 61 | final class DownloadTaskSubscription: Subscription where 62 | SubscriberType.Input == (url: URL, response: URLResponse), 63 | SubscriberType.Failure == URLError { 64 | private var subscriber: SubscriberType? 65 | private weak var session: URLSession! 66 | private var request: URLRequest! 67 | private var task: URLSessionDownloadTask! 68 | 69 | init(subscriber: SubscriberType, session: URLSession, request: URLRequest) { 70 | self.subscriber = subscriber 71 | self.session = session 72 | self.request = request 73 | } 74 | 75 | func request(_ demand: Subscribers.Demand) { 76 | guard demand > 0 else { 77 | return 78 | } 79 | 80 | self.task = self.session.downloadTask(with: request) { [weak self] url, response, error in 81 | if let error = error as? URLError { 82 | self?.subscriber?.receive(completion: .failure(error)) 83 | return 84 | } 85 | guard let response = response else { 86 | self?.subscriber?.receive(completion: .failure(URLError(.badServerResponse))) 87 | return 88 | } 89 | guard let url = url else { 90 | self?.subscriber?.receive(completion: .failure(URLError(.badURL))) 91 | return 92 | } 93 | do { 94 | let cacheDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! 95 | let fileUrl = cacheDir.appendingPathComponent(self?.request.url?.lastPathComponent ?? UUID().uuidString) 96 | try FileManager.default.moveItem(atPath: url.path, toPath: fileUrl.path) 97 | _ = self?.subscriber?.receive((url: fileUrl, response: response)) 98 | self?.subscriber?.receive(completion: .finished) 99 | } 100 | catch { 101 | self?.subscriber?.receive(completion: .failure(URLError(.cannotCreateFile))) 102 | } 103 | } 104 | self.task.resume() 105 | } 106 | 107 | func cancel() { 108 | self.task.cancel() 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /SSMediaLibrary/SSMediaLibrary/SSMediaLibrary.docc/Classes/UTI.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UTI.swift 3 | // fseventstool 4 | // 5 | // Created by Matthias Keiser on 09.01.17. 6 | // Copyright © 2017 Tristan Inc. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(iOS) || os(watchOS) 12 | import MobileCoreServices 13 | #elseif os(macOS) 14 | import CoreServices 15 | #endif 16 | 17 | /// Instances of the UTI class represent a specific Universal Type Identifier, e.g. kUTTypeMPEG4. 18 | 19 | public class UTI: RawRepresentable, Equatable { 20 | 21 | /** 22 | The TagClass enum represents the supported tag classes. 23 | 24 | - fileExtension: kUTTagClassFilenameExtension 25 | - mimeType: kUTTagClassMIMEType 26 | - pbType: kUTTagClassNSPboardType 27 | - osType: kUTTagClassOSType 28 | */ 29 | public enum TagClass: String { 30 | 31 | /// Equivalent to kUTTagClassFilenameExtension 32 | case fileExtension = "public.filename-extension" 33 | 34 | /// Equivalent to kUTTagClassMIMEType 35 | case mimeType = "public.mime-type" 36 | 37 | #if os (macOS) 38 | 39 | /// Equivalent to kUTTagClassNSPboardType 40 | case pbType = "com.apple.nspboard-type" 41 | 42 | /// Equivalent to kUTTagClassOSType 43 | case osType = "com.apple.ostype" 44 | #endif 45 | 46 | /// Convenience variable for internal use. 47 | 48 | fileprivate var rawCFValue: CFString { 49 | return self.rawValue as CFString 50 | } 51 | } 52 | 53 | public typealias RawValue = String 54 | public let rawValue: String 55 | 56 | 57 | /// Convenience variable for internal use. 58 | 59 | private var rawCFValue: CFString { 60 | 61 | return self.rawValue as CFString 62 | } 63 | 64 | // MARK: Initialization 65 | 66 | 67 | /** 68 | 69 | This is the designated initializer of the UTI class. 70 | 71 | - Parameters: 72 | - rawValue: A string that is a Universal Type Identifier, i.e. "com.foobar.baz" or a constant like kUTTypeMP3. 73 | - Returns: 74 | An UTI instance representing the specified rawValue. 75 | - Note: 76 | You should rarely use this method. The preferred way to initialize a known UTI is to use its static variable (i.e. UTI.pdf). You should make an extension to make your own types available as static variables. 77 | 78 | */ 79 | 80 | public required init(rawValue: UTI.RawValue) { 81 | 82 | self.rawValue = rawValue 83 | } 84 | 85 | /** 86 | 87 | Initialize an UTI with a tag of a specified class. 88 | 89 | - Parameters: 90 | - tagClass: The class of the tag. 91 | - value: The value of the tag. 92 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 93 | - Returns: 94 | An UTI instance representing the specified rawValue. If no known UTI with the specified tags is found, a dynamic UTI is created. 95 | - Note: 96 | You should rarely need this method. It's usually simpler to use one of the specialized initialzers like 97 | ```convenience init?(withExtension fileExtension: String, conformingTo conforming: UTI? = nil)``` 98 | */ 99 | 100 | public convenience init(withTagClass tagClass: TagClass, value: String, conformingTo conforming: UTI? = nil) { 101 | 102 | let unmanagedIdentifier = UTTypeCreatePreferredIdentifierForTag(tagClass.rawCFValue, value as CFString, conforming?.rawCFValue) 103 | 104 | // UTTypeCreatePreferredIdentifierForTag only returns nil if the tag class is unknwown, which can't happen to us since we use an 105 | // enum of known values. Hence we can force-cast the result. 106 | 107 | let identifier = (unmanagedIdentifier?.takeRetainedValue() as String?)! 108 | 109 | self.init(rawValue: identifier) 110 | } 111 | 112 | /** 113 | 114 | Initialize an UTI with a file extension. 115 | 116 | - Parameters: 117 | - withExtension: The file extension (e.g. "txt"). 118 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 119 | - Returns: 120 | An UTI corresponding to the specified values. 121 | **/ 122 | 123 | public convenience init(withExtension fileExtension: String, conformingTo conforming: UTI? = nil) { 124 | 125 | self.init(withTagClass:.fileExtension, value: fileExtension, conformingTo: conforming) 126 | } 127 | 128 | /** 129 | 130 | Initialize an UTI with a MIME type. 131 | 132 | - Parameters: 133 | - mimeType: The MIME type (e.g. "text/plain"). 134 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 135 | - Returns: 136 | An UTI corresponding to the specified values. 137 | */ 138 | 139 | public convenience init(withMimeType mimeType: String, conformingTo conforming: UTI? = nil) { 140 | 141 | self.init(withTagClass:.mimeType, value: mimeType, conformingTo: conforming) 142 | } 143 | 144 | #if os(macOS) 145 | 146 | /** 147 | 148 | Initialize an UTI with a pasteboard type. 149 | - Important: **This function is de-facto deprecated!** The old cocoa pasteboard types ( `NSStringPboardType`, `NSPDFPboardType`, etc) have been deprecated in favour of actual UTIs, and the constants are not available anymore in Swift. This function only works correctly with the values of these old constants, but _not_ with the replacement values (like `NSPasteboardTypeString` etc), since these already are UTIs. 150 | - Parameters: 151 | - pbType: The pasteboard type (e.g. NSPDFPboardType). 152 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 153 | - Returns: 154 | An UTI corresponding to the specified values. 155 | */ 156 | public convenience init(withPBType pbType: String, conformingTo conforming: UTI? = nil) { 157 | 158 | self.init(withTagClass:.pbType, value: pbType, conformingTo: conforming) 159 | } 160 | 161 | /** 162 | Initialize an UTI with a OSType. 163 | 164 | - Parameters: 165 | - osType: The OSType type as a string (e.g. "PDF "). 166 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 167 | - Returns: 168 | An UTI corresponding to the specified values. 169 | - Note: 170 | You can use the variable ```OSType.string``` to get a string from an actual OSType. 171 | */ 172 | 173 | public convenience init(withOSType osType: String, conformingTo conforming: UTI? = nil) { 174 | 175 | self.init(withTagClass:.osType, value: osType, conformingTo: conforming) 176 | } 177 | 178 | #endif 179 | 180 | // MARK: Accessing Tags 181 | 182 | /** 183 | 184 | Returns the tag with the specified class. 185 | 186 | - Parameters: 187 | - tagClass: The tag class to return. 188 | - Returns: 189 | The requested tag, or nil if there is no tag of the specified class. 190 | */ 191 | 192 | public func tag(with tagClass: TagClass) -> String? { 193 | 194 | let unmanagedTag = UTTypeCopyPreferredTagWithClass(self.rawCFValue, tagClass.rawCFValue) 195 | 196 | guard let tag = unmanagedTag?.takeRetainedValue() as String? else { 197 | return nil 198 | } 199 | 200 | return tag 201 | } 202 | 203 | /// Return the file extension that corresponds the the UTI. Returns nil if not available. 204 | 205 | public var fileExtension: String? { 206 | 207 | return self.tag(with: .fileExtension) 208 | } 209 | 210 | /// Return the MIME type that corresponds the the UTI. Returns nil if not available. 211 | 212 | public var mimeType: String? { 213 | 214 | return self.tag(with: .mimeType) 215 | } 216 | 217 | #if os(macOS) 218 | 219 | /// Return the pasteboard type that corresponds the the UTI. Returns nil if not available. 220 | 221 | public var pbType: String? { 222 | 223 | return self.tag(with: .pbType) 224 | } 225 | 226 | /// Return the OSType as a string that corresponds the the UTI. Returns nil if not available. 227 | /// - Note: you can use the ```init(with string: String)``` initializer to construct an actual OSType from the returnes string. 228 | 229 | public var osType: String? { 230 | 231 | return self.tag(with: .osType) 232 | } 233 | 234 | #endif 235 | 236 | /** 237 | 238 | Returns all tags of the specified tag class. 239 | 240 | - Parameters: 241 | - tagClass: The class of the requested tags. 242 | - Returns: 243 | An array of all tags of the receiver of the specified class. 244 | */ 245 | 246 | public func tags(with tagClass: TagClass) -> Array { 247 | 248 | let unmanagedTags = UTTypeCopyAllTagsWithClass(self.rawCFValue, tagClass.rawCFValue) 249 | 250 | guard let tags = unmanagedTags?.takeRetainedValue() as? Array else { 251 | return [] 252 | } 253 | 254 | return tags as Array 255 | } 256 | 257 | // MARK: List all UTIs associated with a tag 258 | 259 | 260 | /** 261 | Returns all UTIs that are associated with a specified tag. 262 | 263 | - Parameters: 264 | - tag: The class of the specified tag. 265 | - value: The value of the tag. 266 | - conforming: If specified, the returned UTIs must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 267 | - Returns: 268 | An array of all UTIs that satisfy the specified parameters. 269 | */ 270 | 271 | public static func utis(for tag: TagClass, value: String, conformingTo conforming: UTI? = nil) -> Array { 272 | 273 | let unmanagedIdentifiers = UTTypeCreateAllIdentifiersForTag(tag.rawCFValue, value as CFString, conforming?.rawCFValue) 274 | 275 | 276 | guard let identifiers = unmanagedIdentifiers?.takeRetainedValue() as? Array else { 277 | return [] 278 | } 279 | 280 | return identifiers.compactMap { UTI(rawValue: $0 as String) } 281 | } 282 | 283 | // MARK: Equality and Conformance to other UTIs 284 | 285 | /** 286 | 287 | Checks if the receiver conforms to a specified UTI. 288 | 289 | - Parameters: 290 | - otherUTI: The UTI to which the receiver is compared. 291 | - Returns: 292 | ```true``` if the receiver conforms to the specified UTI, ```false```otherwise. 293 | */ 294 | 295 | public func conforms(to otherUTI: UTI) -> Bool { 296 | 297 | return UTTypeConformsTo(self.rawCFValue, otherUTI.rawCFValue) as Bool 298 | } 299 | 300 | public static func ==(lhs: UTI, rhs: UTI) -> Bool { 301 | 302 | return UTTypeEqual(lhs.rawCFValue, rhs.rawCFValue) as Bool 303 | } 304 | 305 | // MARK: Accessing Information about an UTI 306 | 307 | /// Returns the localized, user-readable type description string associated with a uniform type identifier. 308 | 309 | public var description: String? { 310 | 311 | let unmanagedDescription = UTTypeCopyDescription(self.rawCFValue) 312 | 313 | guard let description = unmanagedDescription?.takeRetainedValue() as String? else { 314 | return nil 315 | } 316 | 317 | return description 318 | } 319 | 320 | /// Returns a uniform type’s declaration as a Dictionary, or nil if if no declaration for that type can be found. 321 | 322 | public var declaration: [AnyHashable:Any]? { 323 | 324 | let unmanagedDeclaration = UTTypeCopyDeclaration(self.rawCFValue) 325 | 326 | guard let declaration = unmanagedDeclaration?.takeRetainedValue() as? [AnyHashable:Any] else { 327 | return nil 328 | } 329 | 330 | return declaration 331 | } 332 | 333 | /// Returns ```true``` if the receiver is a dynamic UTI. 334 | 335 | public var isDynamic: Bool { 336 | 337 | return UTTypeIsDynamic(self.rawCFValue) 338 | } 339 | } 340 | 341 | 342 | // MARK: System defined UTIs 343 | 344 | public extension UTI { 345 | 346 | static let item = UTI(rawValue: kUTTypeItem as String) 347 | static let content = UTI(rawValue: kUTTypeContent as String) 348 | static let compositeContent = UTI(rawValue: kUTTypeCompositeContent as String) 349 | static let message = UTI(rawValue: kUTTypeMessage as String) 350 | static let contact = UTI(rawValue: kUTTypeContact as String) 351 | static let archive = UTI(rawValue: kUTTypeArchive as String) 352 | static let diskImage = UTI(rawValue: kUTTypeDiskImage as String) 353 | static let data = UTI(rawValue: kUTTypeData as String) 354 | static let directory = UTI(rawValue: kUTTypeDirectory as String) 355 | static let resolvable = UTI(rawValue: kUTTypeResolvable as String) 356 | static let symLink = UTI(rawValue: kUTTypeSymLink as String) 357 | static let executable = UTI(rawValue: kUTTypeExecutable as String) 358 | static let mountPoint = UTI(rawValue: kUTTypeMountPoint as String) 359 | static let aliasFile = UTI(rawValue: kUTTypeAliasFile as String) 360 | static let aliasRecord = UTI(rawValue: kUTTypeAliasRecord as String) 361 | static let urlBookmarkData = UTI(rawValue: kUTTypeURLBookmarkData as String) 362 | static let url = UTI(rawValue: kUTTypeURL as String) 363 | static let fileURL = UTI(rawValue: kUTTypeFileURL as String) 364 | static let text = UTI(rawValue: kUTTypeText as String) 365 | static let plainText = UTI(rawValue: kUTTypePlainText as String) 366 | static let utf8PlainText = UTI(rawValue: kUTTypeUTF8PlainText as String) 367 | static let utf16ExternalPlainText = UTI(rawValue: kUTTypeUTF16ExternalPlainText as String) 368 | static let utf16PlainText = UTI(rawValue: kUTTypeUTF16PlainText as String) 369 | static let delimitedText = UTI(rawValue: kUTTypeDelimitedText as String) 370 | static let commaSeparatedText = UTI(rawValue: kUTTypeCommaSeparatedText as String) 371 | static let tabSeparatedText = UTI(rawValue: kUTTypeTabSeparatedText as String) 372 | static let utf8TabSeparatedText = UTI(rawValue: kUTTypeUTF8TabSeparatedText as String) 373 | static let rtf = UTI(rawValue: kUTTypeRTF as String) 374 | static let html = UTI(rawValue: kUTTypeHTML as String) 375 | static let xml = UTI(rawValue: kUTTypeXML as String) 376 | static let sourceCode = UTI(rawValue: kUTTypeSourceCode as String) 377 | static let assemblyLanguageSource = UTI(rawValue: kUTTypeAssemblyLanguageSource as String) 378 | static let cSource = UTI(rawValue: kUTTypeCSource as String) 379 | static let objectiveCSource = UTI(rawValue: kUTTypeObjectiveCSource as String) 380 | @available( OSX 10.11, iOS 9.0, * ) 381 | static let swiftSource = UTI(rawValue: kUTTypeSwiftSource as String) 382 | static let cPlusPlusSource = UTI(rawValue: kUTTypeCPlusPlusSource as String) 383 | static let objectiveCPlusPlusSource = UTI(rawValue: kUTTypeObjectiveCPlusPlusSource as String) 384 | static let cHeader = UTI(rawValue: kUTTypeCHeader as String) 385 | static let cPlusPlusHeader = UTI(rawValue: kUTTypeCPlusPlusHeader as String) 386 | static let javaSource = UTI(rawValue: kUTTypeJavaSource as String) 387 | static let script = UTI(rawValue: kUTTypeScript as String) 388 | static let appleScript = UTI(rawValue: kUTTypeAppleScript as String) 389 | static let osaScript = UTI(rawValue: kUTTypeOSAScript as String) 390 | static let osaScriptBundle = UTI(rawValue: kUTTypeOSAScriptBundle as String) 391 | static let javaScript = UTI(rawValue: kUTTypeJavaScript as String) 392 | static let shellScript = UTI(rawValue: kUTTypeShellScript as String) 393 | static let perlScript = UTI(rawValue: kUTTypePerlScript as String) 394 | static let pythonScript = UTI(rawValue: kUTTypePythonScript as String) 395 | static let rubyScript = UTI(rawValue: kUTTypeRubyScript as String) 396 | static let phpScript = UTI(rawValue: kUTTypePHPScript as String) 397 | static let json = UTI(rawValue: kUTTypeJSON as String) 398 | static let propertyList = UTI(rawValue: kUTTypePropertyList as String) 399 | static let xmlPropertyList = UTI(rawValue: kUTTypeXMLPropertyList as String) 400 | static let binaryPropertyList = UTI(rawValue: kUTTypeBinaryPropertyList as String) 401 | static let pdf = UTI(rawValue: kUTTypePDF as String) 402 | static let rtfd = UTI(rawValue: kUTTypeRTFD as String) 403 | static let flatRTFD = UTI(rawValue: kUTTypeFlatRTFD as String) 404 | static let txnTextAndMultimediaData = UTI(rawValue: kUTTypeTXNTextAndMultimediaData as String) 405 | static let webArchive = UTI(rawValue: kUTTypeWebArchive as String) 406 | static let image = UTI(rawValue: kUTTypeImage as String) 407 | static let jpeg = UTI(rawValue: kUTTypeJPEG as String) 408 | static let jpeg2000 = UTI(rawValue: kUTTypeJPEG2000 as String) 409 | static let tiff = UTI(rawValue: kUTTypeTIFF as String) 410 | static let pict = UTI(rawValue: kUTTypePICT as String) 411 | static let gif = UTI(rawValue: kUTTypeGIF as String) 412 | static let png = UTI(rawValue: kUTTypePNG as String) 413 | static let quickTimeImage = UTI(rawValue: kUTTypeQuickTimeImage as String) 414 | static let appleICNS = UTI(rawValue: kUTTypeAppleICNS as String) 415 | static let bmp = UTI(rawValue: kUTTypeBMP as String) 416 | static let ico = UTI(rawValue: kUTTypeICO as String) 417 | static let rawImage = UTI(rawValue: kUTTypeRawImage as String) 418 | static let scalableVectorGraphics = UTI(rawValue: kUTTypeScalableVectorGraphics as String) 419 | @available(OSX 10.12, iOS 9.1, watchOS 2.1, *) 420 | static let livePhoto = UTI(rawValue: kUTTypeLivePhoto as String) 421 | @available(OSX 10.12, iOS 9.1, *) 422 | static let audiovisualContent = UTI(rawValue: kUTTypeAudiovisualContent as String) 423 | static let movie = UTI(rawValue: kUTTypeMovie as String) 424 | static let video = UTI(rawValue: kUTTypeVideo as String) 425 | static let audio = UTI(rawValue: kUTTypeAudio as String) 426 | static let quickTimeMovie = UTI(rawValue: kUTTypeQuickTimeMovie as String) 427 | static let mpeg = UTI(rawValue: kUTTypeMPEG as String) 428 | static let mpeg2Video = UTI(rawValue: kUTTypeMPEG2Video as String) 429 | static let mpeg2TransportStream = UTI(rawValue: kUTTypeMPEG2TransportStream as String) 430 | static let mp3 = UTI(rawValue: kUTTypeMP3 as String) 431 | static let mpeg4 = UTI(rawValue: kUTTypeMPEG4 as String) 432 | static let mpeg4Audio = UTI(rawValue: kUTTypeMPEG4Audio as String) 433 | static let appleProtectedMPEG4Audio = UTI(rawValue: kUTTypeAppleProtectedMPEG4Audio as String) 434 | static let appleProtectedMPEG4Video = UTI(rawValue: kUTTypeAppleProtectedMPEG4Video as String) 435 | static let aviMovie = UTI(rawValue: kUTTypeAVIMovie as String) 436 | static let audioInterchangeFileFormat = UTI(rawValue: kUTTypeAudioInterchangeFileFormat as String) 437 | static let waveformAudio = UTI(rawValue: kUTTypeWaveformAudio as String) 438 | static let midiAudio = UTI(rawValue: kUTTypeMIDIAudio as String) 439 | static let playlist = UTI(rawValue: kUTTypePlaylist as String) 440 | static let m3UPlaylist = UTI(rawValue: kUTTypeM3UPlaylist as String) 441 | static let folder = UTI(rawValue: kUTTypeFolder as String) 442 | static let volume = UTI(rawValue: kUTTypeVolume as String) 443 | static let package = UTI(rawValue: kUTTypePackage as String) 444 | static let bundle = UTI(rawValue: kUTTypeBundle as String) 445 | static let pluginBundle = UTI(rawValue: kUTTypePluginBundle as String) 446 | static let spotlightImporter = UTI(rawValue: kUTTypeSpotlightImporter as String) 447 | static let quickLookGenerator = UTI(rawValue: kUTTypeQuickLookGenerator as String) 448 | static let xpcService = UTI(rawValue: kUTTypeXPCService as String) 449 | static let framework = UTI(rawValue: kUTTypeFramework as String) 450 | static let application = UTI(rawValue: kUTTypeApplication as String) 451 | static let applicationBundle = UTI(rawValue: kUTTypeApplicationBundle as String) 452 | static let applicationFile = UTI(rawValue: kUTTypeApplicationFile as String) 453 | static let unixExecutable = UTI(rawValue: kUTTypeUnixExecutable as String) 454 | static let windowsExecutable = UTI(rawValue: kUTTypeWindowsExecutable as String) 455 | static let javaClass = UTI(rawValue: kUTTypeJavaClass as String) 456 | static let javaArchive = UTI(rawValue: kUTTypeJavaArchive as String) 457 | static let systemPreferencesPane = UTI(rawValue: kUTTypeSystemPreferencesPane as String) 458 | static let gnuZipArchive = UTI(rawValue: kUTTypeGNUZipArchive as String) 459 | static let bzip2Archive = UTI(rawValue: kUTTypeBzip2Archive as String) 460 | static let zipArchive = UTI(rawValue: kUTTypeZipArchive as String) 461 | static let spreadsheet = UTI(rawValue: kUTTypeSpreadsheet as String) 462 | static let presentation = UTI(rawValue: kUTTypePresentation as String) 463 | static let database = UTI(rawValue: kUTTypeDatabase as String) 464 | static let vCard = UTI(rawValue: kUTTypeVCard as String) 465 | static let toDoItem = UTI(rawValue: kUTTypeToDoItem as String) 466 | static let calendarEvent = UTI(rawValue: kUTTypeCalendarEvent as String) 467 | static let emailMessage = UTI(rawValue: kUTTypeEmailMessage as String) 468 | static let internetLocation = UTI(rawValue: kUTTypeInternetLocation as String) 469 | static let inkText = UTI(rawValue: kUTTypeInkText as String) 470 | static let font = UTI(rawValue: kUTTypeFont as String) 471 | static let bookmark = UTI(rawValue: kUTTypeBookmark as String) 472 | static let _3DContent = UTI(rawValue: kUTType3DContent as String) 473 | static let pkcs12 = UTI(rawValue: kUTTypePKCS12 as String) 474 | static let x509Certificate = UTI(rawValue: kUTTypeX509Certificate as String) 475 | static let electronicPublication = UTI(rawValue: kUTTypeElectronicPublication as String) 476 | static let log = UTI(rawValue: kUTTypeLog as String) 477 | static let docx = UTI(rawValue: "org.openxmlformats.wordprocessingml.document") 478 | static let doc = UTI(rawValue: "com.microsoft.word.doc") 479 | } 480 | 481 | #if os(OSX) 482 | 483 | extension OSType { 484 | 485 | 486 | /// Returns the OSType encoded as a String. 487 | 488 | var string: String { 489 | 490 | let unmanagedString = UTCreateStringForOSType(self) 491 | 492 | return unmanagedString.takeRetainedValue() as String 493 | } 494 | 495 | 496 | /// Initializes a OSType from a String. 497 | /// 498 | /// - Parameter string: A String representing an OSType. 499 | 500 | init(with string: String) { 501 | 502 | self = UTGetOSTypeFromString(string as CFString) 503 | } 504 | } 505 | 506 | #endif 507 | -------------------------------------------------------------------------------- /SSMediaLibrary/SSMediaLibrary/SSMediaLibraryHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSMediaLibrary.h 3 | // SSMediaLibrary 4 | // 5 | // Created by Devansh Vyas on 16/07/21. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for SSMediaLibrary. 11 | FOUNDATION_EXPORT double SSMediaLibraryVersionNumber; 12 | 13 | //! Project version string for SSMediaLibrary. 14 | FOUNDATION_EXPORT const unsigned char SSMediaLibraryVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /SSMediaLibraryExample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimformSolutionsPvtLtd/SSMediaLibrary/c4df15e8ac990529bded219cf22cef565ae31508/SSMediaLibraryExample.gif -------------------------------------------------------------------------------- /Sources/SSMediaLibrary/MediaManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MediaManager.swift 3 | // SSMediaLibrary 4 | // 5 | // Created by Devansh Vyas on 16/06/21. 6 | // 7 | 8 | import UIKit 9 | import Combine 10 | import QuickLook 11 | import AVKit 12 | import SafariServices 13 | 14 | class MediaManager { 15 | var mediaUrl: URL? 16 | var mediaExtension: UTI? 17 | var sinkOperation: AnyCancellable? 18 | var localUrl: URL? 19 | 20 | private weak var topVC: UIViewController? { 21 | guard var topController = UIApplication.shared.windows.first?.rootViewController 22 | else { return nil } 23 | 24 | while let presentedViewController = topController.presentedViewController { 25 | topController = presentedViewController 26 | } 27 | return topController 28 | } 29 | 30 | var isAudioVideo: Bool { 31 | guard let mediaExtension = mediaExtension else { 32 | return false 33 | } 34 | 35 | switch mediaExtension { 36 | case .audiovisualContent, .movie, .video, .audio, .quickTimeMovie, .mpeg, .mpeg2Video, .mpeg2TransportStream, 37 | .mp3, .mpeg4, .mpeg4Audio, .appleProtectedMPEG4Audio, .appleProtectedMPEG4Video, .aviMovie, 38 | .audioInterchangeFileFormat, .waveformAudio, .midiAudio, .playlist, .m3UPlaylist: 39 | return true 40 | default: 41 | return false 42 | } 43 | } 44 | 45 | init(url: URL) { 46 | mediaUrl = url 47 | localUrl = url 48 | mediaExtension = UTI(withExtension: url.pathExtension) 49 | } 50 | 51 | func show() { 52 | guard let mediaUrl = mediaUrl else { 53 | return 54 | } 55 | if let filePath = getFileFromLocal() { 56 | localUrl = filePath 57 | openFile() 58 | } else { 59 | if isAudioVideo { 60 | openVideoPlayer() 61 | } 62 | if mediaExtension != .html { 63 | downloadFile(url: mediaUrl) 64 | } 65 | } 66 | } 67 | 68 | func getFileFromLocal() -> URL? { 69 | guard let fileName = mediaUrl?.lastPathComponent, 70 | var documentDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first 71 | else { return nil } 72 | documentDir.appendPathComponent(fileName) 73 | return FileManager.default.fileExists(atPath: documentDir.path) ? URL(fileURLWithPath: documentDir.path) : nil 74 | } 75 | 76 | func downloadFile(url: URL) { 77 | sinkOperation = URLSession.shared 78 | .downloadTaskPublisher(for: url) 79 | .sink(receiveCompletion: { completion in 80 | print("Sink completion: \(completion)") 81 | }) { value in 82 | print("Sink value: \(value.url)") 83 | DispatchQueue.main.async { 84 | self.localUrl = value.url 85 | if !self.isAudioVideo { 86 | self.openFile() 87 | } 88 | } 89 | } 90 | } 91 | 92 | func openFile() { 93 | guard let mediaExtension = mediaExtension else { 94 | return 95 | } 96 | switch mediaExtension { 97 | case .html: 98 | openHtml() 99 | 100 | case .audiovisualContent, .movie, .video, .audio, .quickTimeMovie, .mpeg, .mpeg2Video, .mpeg2TransportStream, 101 | .mp3, .mpeg4, .mpeg4Audio, .appleProtectedMPEG4Audio, .appleProtectedMPEG4Video, .aviMovie, 102 | .audioInterchangeFileFormat, .waveformAudio, .midiAudio, .playlist, .m3UPlaylist: 103 | openVideoPlayer() 104 | 105 | default: 106 | openWithQuickLook() 107 | } 108 | } 109 | 110 | func openHtml() { 111 | guard let url = mediaUrl else { return } 112 | print("===>> \(url)") 113 | let vc = SFSafariViewController(url: url) 114 | topVC?.present(vc, animated: true) 115 | } 116 | 117 | func openVideoPlayer() { 118 | guard let localUrl = localUrl else { 119 | return 120 | } 121 | let player = AVPlayer(url: localUrl) 122 | let playerViewController = AVPlayerViewController() 123 | playerViewController.player = player 124 | topVC?.present(playerViewController, animated: true) { 125 | playerViewController.player?.play() 126 | } 127 | } 128 | 129 | func openWithQuickLook() { 130 | let previewController = QLPreviewController() 131 | previewController.dataSource = self 132 | topVC?.present(previewController, animated: true, completion: nil) 133 | } 134 | } 135 | 136 | extension MediaManager: QLPreviewControllerDataSource { 137 | func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { 138 | print("===> \(String(describing: localUrl))") 139 | guard let url = localUrl else { 140 | fatalError() 141 | } 142 | return url as QLPreviewItem 143 | } 144 | 145 | func numberOfPreviewItems(in controller: QLPreviewController) -> Int { 146 | return 1 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /Sources/SSMediaLibrary/NetworkManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkManager.swift 3 | // SSMediaLibrary 4 | // 5 | // Created by Devansh Vyas on 16/06/21. 6 | // 7 | 8 | import Foundation 9 | import Combine 10 | 11 | class NetworkManager { 12 | static let shared = NetworkManager() 13 | var sinkOperation: AnyCancellable? 14 | 15 | func downloadFile(url: URL) { 16 | sinkOperation = URLSession.shared 17 | .downloadTaskPublisher(for: url) 18 | .sink(receiveCompletion: { completion in 19 | print("Sink completion: \(completion)") 20 | }) { value in 21 | print("Sink value: \(value.url)") 22 | } 23 | } 24 | } 25 | 26 | 27 | extension URLSession { 28 | public func downloadTaskPublisher(for url: URL) -> URLSession.DownloadTaskPublisher { 29 | self.downloadTaskPublisher(for: .init(url: url)) 30 | } 31 | 32 | public func downloadTaskPublisher(for request: URLRequest) -> URLSession.DownloadTaskPublisher { 33 | .init(request: request, session: self) 34 | } 35 | 36 | public struct DownloadTaskPublisher: Publisher { 37 | 38 | public typealias Output = (url: URL, response: URLResponse) 39 | public typealias Failure = URLError 40 | 41 | public let request: URLRequest 42 | public let session: URLSession 43 | 44 | public init(request: URLRequest, session: URLSession) { 45 | self.request = request 46 | self.session = session 47 | } 48 | 49 | public func receive(subscriber: S) where S: Subscriber, 50 | DownloadTaskPublisher.Failure == S.Failure, 51 | DownloadTaskPublisher.Output == S.Input 52 | { 53 | let subscription = DownloadTaskSubscription(subscriber: subscriber, session: self.session, request: self.request) 54 | subscriber.receive(subscription: subscription) 55 | } 56 | } 57 | } 58 | 59 | extension URLSession { 60 | 61 | final class DownloadTaskSubscription: Subscription where 62 | SubscriberType.Input == (url: URL, response: URLResponse), 63 | SubscriberType.Failure == URLError { 64 | private var subscriber: SubscriberType? 65 | private weak var session: URLSession! 66 | private var request: URLRequest! 67 | private var task: URLSessionDownloadTask! 68 | 69 | init(subscriber: SubscriberType, session: URLSession, request: URLRequest) { 70 | self.subscriber = subscriber 71 | self.session = session 72 | self.request = request 73 | } 74 | 75 | func request(_ demand: Subscribers.Demand) { 76 | guard demand > 0 else { 77 | return 78 | } 79 | 80 | self.task = self.session.downloadTask(with: request) { [weak self] url, response, error in 81 | if let error = error as? URLError { 82 | self?.subscriber?.receive(completion: .failure(error)) 83 | return 84 | } 85 | guard let response = response else { 86 | self?.subscriber?.receive(completion: .failure(URLError(.badServerResponse))) 87 | return 88 | } 89 | guard let url = url else { 90 | self?.subscriber?.receive(completion: .failure(URLError(.badURL))) 91 | return 92 | } 93 | do { 94 | let cacheDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! 95 | let fileUrl = cacheDir.appendingPathComponent(self?.request.url?.lastPathComponent ?? UUID().uuidString) 96 | try FileManager.default.moveItem(atPath: url.path, toPath: fileUrl.path) 97 | _ = self?.subscriber?.receive((url: fileUrl, response: response)) 98 | self?.subscriber?.receive(completion: .finished) 99 | } 100 | catch { 101 | self?.subscriber?.receive(completion: .failure(URLError(.cannotCreateFile))) 102 | } 103 | } 104 | self.task.resume() 105 | } 106 | 107 | func cancel() { 108 | self.task.cancel() 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /Sources/SSMediaLibrary/UTI.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UTI.swift 3 | // fseventstool 4 | // 5 | // Created by Matthias Keiser on 09.01.17. 6 | // Copyright © 2017 Tristan Inc. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(iOS) || os(watchOS) 12 | import MobileCoreServices 13 | #elseif os(macOS) 14 | import CoreServices 15 | #endif 16 | 17 | /// Instances of the UTI class represent a specific Universal Type Identifier, e.g. kUTTypeMPEG4. 18 | 19 | public class UTI: RawRepresentable, Equatable { 20 | 21 | /** 22 | The TagClass enum represents the supported tag classes. 23 | 24 | - fileExtension: kUTTagClassFilenameExtension 25 | - mimeType: kUTTagClassMIMEType 26 | - pbType: kUTTagClassNSPboardType 27 | - osType: kUTTagClassOSType 28 | */ 29 | public enum TagClass: String { 30 | 31 | /// Equivalent to kUTTagClassFilenameExtension 32 | case fileExtension = "public.filename-extension" 33 | 34 | /// Equivalent to kUTTagClassMIMEType 35 | case mimeType = "public.mime-type" 36 | 37 | #if os (macOS) 38 | 39 | /// Equivalent to kUTTagClassNSPboardType 40 | case pbType = "com.apple.nspboard-type" 41 | 42 | /// Equivalent to kUTTagClassOSType 43 | case osType = "com.apple.ostype" 44 | #endif 45 | 46 | /// Convenience variable for internal use. 47 | 48 | fileprivate var rawCFValue: CFString { 49 | return self.rawValue as CFString 50 | } 51 | } 52 | 53 | public typealias RawValue = String 54 | public let rawValue: String 55 | 56 | 57 | /// Convenience variable for internal use. 58 | 59 | private var rawCFValue: CFString { 60 | 61 | return self.rawValue as CFString 62 | } 63 | 64 | // MARK: Initialization 65 | 66 | 67 | /** 68 | 69 | This is the designated initializer of the UTI class. 70 | 71 | - Parameters: 72 | - rawValue: A string that is a Universal Type Identifier, i.e. "com.foobar.baz" or a constant like kUTTypeMP3. 73 | - Returns: 74 | An UTI instance representing the specified rawValue. 75 | - Note: 76 | You should rarely use this method. The preferred way to initialize a known UTI is to use its static variable (i.e. UTI.pdf). You should make an extension to make your own types available as static variables. 77 | 78 | */ 79 | 80 | public required init(rawValue: UTI.RawValue) { 81 | 82 | self.rawValue = rawValue 83 | } 84 | 85 | /** 86 | 87 | Initialize an UTI with a tag of a specified class. 88 | 89 | - Parameters: 90 | - tagClass: The class of the tag. 91 | - value: The value of the tag. 92 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 93 | - Returns: 94 | An UTI instance representing the specified rawValue. If no known UTI with the specified tags is found, a dynamic UTI is created. 95 | - Note: 96 | You should rarely need this method. It's usually simpler to use one of the specialized initialzers like 97 | ```convenience init?(withExtension fileExtension: String, conformingTo conforming: UTI? = nil)``` 98 | */ 99 | 100 | public convenience init(withTagClass tagClass: TagClass, value: String, conformingTo conforming: UTI? = nil) { 101 | 102 | let unmanagedIdentifier = UTTypeCreatePreferredIdentifierForTag(tagClass.rawCFValue, value as CFString, conforming?.rawCFValue) 103 | 104 | // UTTypeCreatePreferredIdentifierForTag only returns nil if the tag class is unknwown, which can't happen to us since we use an 105 | // enum of known values. Hence we can force-cast the result. 106 | 107 | let identifier = (unmanagedIdentifier?.takeRetainedValue() as String?)! 108 | 109 | self.init(rawValue: identifier) 110 | } 111 | 112 | /** 113 | 114 | Initialize an UTI with a file extension. 115 | 116 | - Parameters: 117 | - withExtension: The file extension (e.g. "txt"). 118 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 119 | - Returns: 120 | An UTI corresponding to the specified values. 121 | **/ 122 | 123 | public convenience init(withExtension fileExtension: String, conformingTo conforming: UTI? = nil) { 124 | 125 | self.init(withTagClass:.fileExtension, value: fileExtension, conformingTo: conforming) 126 | } 127 | 128 | /** 129 | 130 | Initialize an UTI with a MIME type. 131 | 132 | - Parameters: 133 | - mimeType: The MIME type (e.g. "text/plain"). 134 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 135 | - Returns: 136 | An UTI corresponding to the specified values. 137 | */ 138 | 139 | public convenience init(withMimeType mimeType: String, conformingTo conforming: UTI? = nil) { 140 | 141 | self.init(withTagClass:.mimeType, value: mimeType, conformingTo: conforming) 142 | } 143 | 144 | #if os(macOS) 145 | 146 | /** 147 | 148 | Initialize an UTI with a pasteboard type. 149 | - Important: **This function is de-facto deprecated!** The old cocoa pasteboard types ( `NSStringPboardType`, `NSPDFPboardType`, etc) have been deprecated in favour of actual UTIs, and the constants are not available anymore in Swift. This function only works correctly with the values of these old constants, but _not_ with the replacement values (like `NSPasteboardTypeString` etc), since these already are UTIs. 150 | - Parameters: 151 | - pbType: The pasteboard type (e.g. NSPDFPboardType). 152 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 153 | - Returns: 154 | An UTI corresponding to the specified values. 155 | */ 156 | public convenience init(withPBType pbType: String, conformingTo conforming: UTI? = nil) { 157 | 158 | self.init(withTagClass:.pbType, value: pbType, conformingTo: conforming) 159 | } 160 | 161 | /** 162 | Initialize an UTI with a OSType. 163 | 164 | - Parameters: 165 | - osType: The OSType type as a string (e.g. "PDF "). 166 | - conformingTo: If specified, the returned UTI must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 167 | - Returns: 168 | An UTI corresponding to the specified values. 169 | - Note: 170 | You can use the variable ```OSType.string``` to get a string from an actual OSType. 171 | */ 172 | 173 | public convenience init(withOSType osType: String, conformingTo conforming: UTI? = nil) { 174 | 175 | self.init(withTagClass:.osType, value: osType, conformingTo: conforming) 176 | } 177 | 178 | #endif 179 | 180 | // MARK: Accessing Tags 181 | 182 | /** 183 | 184 | Returns the tag with the specified class. 185 | 186 | - Parameters: 187 | - tagClass: The tag class to return. 188 | - Returns: 189 | The requested tag, or nil if there is no tag of the specified class. 190 | */ 191 | 192 | public func tag(with tagClass: TagClass) -> String? { 193 | 194 | let unmanagedTag = UTTypeCopyPreferredTagWithClass(self.rawCFValue, tagClass.rawCFValue) 195 | 196 | guard let tag = unmanagedTag?.takeRetainedValue() as String? else { 197 | return nil 198 | } 199 | 200 | return tag 201 | } 202 | 203 | /// Return the file extension that corresponds the the UTI. Returns nil if not available. 204 | 205 | public var fileExtension: String? { 206 | 207 | return self.tag(with: .fileExtension) 208 | } 209 | 210 | /// Return the MIME type that corresponds the the UTI. Returns nil if not available. 211 | 212 | public var mimeType: String? { 213 | 214 | return self.tag(with: .mimeType) 215 | } 216 | 217 | #if os(macOS) 218 | 219 | /// Return the pasteboard type that corresponds the the UTI. Returns nil if not available. 220 | 221 | public var pbType: String? { 222 | 223 | return self.tag(with: .pbType) 224 | } 225 | 226 | /// Return the OSType as a string that corresponds the the UTI. Returns nil if not available. 227 | /// - Note: you can use the ```init(with string: String)``` initializer to construct an actual OSType from the returnes string. 228 | 229 | public var osType: String? { 230 | 231 | return self.tag(with: .osType) 232 | } 233 | 234 | #endif 235 | 236 | /** 237 | 238 | Returns all tags of the specified tag class. 239 | 240 | - Parameters: 241 | - tagClass: The class of the requested tags. 242 | - Returns: 243 | An array of all tags of the receiver of the specified class. 244 | */ 245 | 246 | public func tags(with tagClass: TagClass) -> Array { 247 | 248 | let unmanagedTags = UTTypeCopyAllTagsWithClass(self.rawCFValue, tagClass.rawCFValue) 249 | 250 | guard let tags = unmanagedTags?.takeRetainedValue() as? Array else { 251 | return [] 252 | } 253 | 254 | return tags as Array 255 | } 256 | 257 | // MARK: List all UTIs associated with a tag 258 | 259 | 260 | /** 261 | Returns all UTIs that are associated with a specified tag. 262 | 263 | - Parameters: 264 | - tag: The class of the specified tag. 265 | - value: The value of the tag. 266 | - conforming: If specified, the returned UTIs must conform to this UTI. If nil is specified, this parameter is ignored. The default is nil. 267 | - Returns: 268 | An array of all UTIs that satisfy the specified parameters. 269 | */ 270 | 271 | public static func utis(for tag: TagClass, value: String, conformingTo conforming: UTI? = nil) -> Array { 272 | 273 | let unmanagedIdentifiers = UTTypeCreateAllIdentifiersForTag(tag.rawCFValue, value as CFString, conforming?.rawCFValue) 274 | 275 | 276 | guard let identifiers = unmanagedIdentifiers?.takeRetainedValue() as? Array else { 277 | return [] 278 | } 279 | 280 | return identifiers.compactMap { UTI(rawValue: $0 as String) } 281 | } 282 | 283 | // MARK: Equality and Conformance to other UTIs 284 | 285 | /** 286 | 287 | Checks if the receiver conforms to a specified UTI. 288 | 289 | - Parameters: 290 | - otherUTI: The UTI to which the receiver is compared. 291 | - Returns: 292 | ```true``` if the receiver conforms to the specified UTI, ```false```otherwise. 293 | */ 294 | 295 | public func conforms(to otherUTI: UTI) -> Bool { 296 | 297 | return UTTypeConformsTo(self.rawCFValue, otherUTI.rawCFValue) as Bool 298 | } 299 | 300 | public static func ==(lhs: UTI, rhs: UTI) -> Bool { 301 | 302 | return UTTypeEqual(lhs.rawCFValue, rhs.rawCFValue) as Bool 303 | } 304 | 305 | // MARK: Accessing Information about an UTI 306 | 307 | /// Returns the localized, user-readable type description string associated with a uniform type identifier. 308 | 309 | public var description: String? { 310 | 311 | let unmanagedDescription = UTTypeCopyDescription(self.rawCFValue) 312 | 313 | guard let description = unmanagedDescription?.takeRetainedValue() as String? else { 314 | return nil 315 | } 316 | 317 | return description 318 | } 319 | 320 | /// Returns a uniform type’s declaration as a Dictionary, or nil if if no declaration for that type can be found. 321 | 322 | public var declaration: [AnyHashable:Any]? { 323 | 324 | let unmanagedDeclaration = UTTypeCopyDeclaration(self.rawCFValue) 325 | 326 | guard let declaration = unmanagedDeclaration?.takeRetainedValue() as? [AnyHashable:Any] else { 327 | return nil 328 | } 329 | 330 | return declaration 331 | } 332 | 333 | /// Returns ```true``` if the receiver is a dynamic UTI. 334 | 335 | public var isDynamic: Bool { 336 | 337 | return UTTypeIsDynamic(self.rawCFValue) 338 | } 339 | } 340 | 341 | 342 | // MARK: System defined UTIs 343 | 344 | public extension UTI { 345 | 346 | static let item = UTI(rawValue: kUTTypeItem as String) 347 | static let content = UTI(rawValue: kUTTypeContent as String) 348 | static let compositeContent = UTI(rawValue: kUTTypeCompositeContent as String) 349 | static let message = UTI(rawValue: kUTTypeMessage as String) 350 | static let contact = UTI(rawValue: kUTTypeContact as String) 351 | static let archive = UTI(rawValue: kUTTypeArchive as String) 352 | static let diskImage = UTI(rawValue: kUTTypeDiskImage as String) 353 | static let data = UTI(rawValue: kUTTypeData as String) 354 | static let directory = UTI(rawValue: kUTTypeDirectory as String) 355 | static let resolvable = UTI(rawValue: kUTTypeResolvable as String) 356 | static let symLink = UTI(rawValue: kUTTypeSymLink as String) 357 | static let executable = UTI(rawValue: kUTTypeExecutable as String) 358 | static let mountPoint = UTI(rawValue: kUTTypeMountPoint as String) 359 | static let aliasFile = UTI(rawValue: kUTTypeAliasFile as String) 360 | static let aliasRecord = UTI(rawValue: kUTTypeAliasRecord as String) 361 | static let urlBookmarkData = UTI(rawValue: kUTTypeURLBookmarkData as String) 362 | static let url = UTI(rawValue: kUTTypeURL as String) 363 | static let fileURL = UTI(rawValue: kUTTypeFileURL as String) 364 | static let text = UTI(rawValue: kUTTypeText as String) 365 | static let plainText = UTI(rawValue: kUTTypePlainText as String) 366 | static let utf8PlainText = UTI(rawValue: kUTTypeUTF8PlainText as String) 367 | static let utf16ExternalPlainText = UTI(rawValue: kUTTypeUTF16ExternalPlainText as String) 368 | static let utf16PlainText = UTI(rawValue: kUTTypeUTF16PlainText as String) 369 | static let delimitedText = UTI(rawValue: kUTTypeDelimitedText as String) 370 | static let commaSeparatedText = UTI(rawValue: kUTTypeCommaSeparatedText as String) 371 | static let tabSeparatedText = UTI(rawValue: kUTTypeTabSeparatedText as String) 372 | static let utf8TabSeparatedText = UTI(rawValue: kUTTypeUTF8TabSeparatedText as String) 373 | static let rtf = UTI(rawValue: kUTTypeRTF as String) 374 | static let html = UTI(rawValue: kUTTypeHTML as String) 375 | static let xml = UTI(rawValue: kUTTypeXML as String) 376 | static let sourceCode = UTI(rawValue: kUTTypeSourceCode as String) 377 | static let assemblyLanguageSource = UTI(rawValue: kUTTypeAssemblyLanguageSource as String) 378 | static let cSource = UTI(rawValue: kUTTypeCSource as String) 379 | static let objectiveCSource = UTI(rawValue: kUTTypeObjectiveCSource as String) 380 | @available( OSX 10.11, iOS 9.0, * ) 381 | static let swiftSource = UTI(rawValue: kUTTypeSwiftSource as String) 382 | static let cPlusPlusSource = UTI(rawValue: kUTTypeCPlusPlusSource as String) 383 | static let objectiveCPlusPlusSource = UTI(rawValue: kUTTypeObjectiveCPlusPlusSource as String) 384 | static let cHeader = UTI(rawValue: kUTTypeCHeader as String) 385 | static let cPlusPlusHeader = UTI(rawValue: kUTTypeCPlusPlusHeader as String) 386 | static let javaSource = UTI(rawValue: kUTTypeJavaSource as String) 387 | static let script = UTI(rawValue: kUTTypeScript as String) 388 | static let appleScript = UTI(rawValue: kUTTypeAppleScript as String) 389 | static let osaScript = UTI(rawValue: kUTTypeOSAScript as String) 390 | static let osaScriptBundle = UTI(rawValue: kUTTypeOSAScriptBundle as String) 391 | static let javaScript = UTI(rawValue: kUTTypeJavaScript as String) 392 | static let shellScript = UTI(rawValue: kUTTypeShellScript as String) 393 | static let perlScript = UTI(rawValue: kUTTypePerlScript as String) 394 | static let pythonScript = UTI(rawValue: kUTTypePythonScript as String) 395 | static let rubyScript = UTI(rawValue: kUTTypeRubyScript as String) 396 | static let phpScript = UTI(rawValue: kUTTypePHPScript as String) 397 | static let json = UTI(rawValue: kUTTypeJSON as String) 398 | static let propertyList = UTI(rawValue: kUTTypePropertyList as String) 399 | static let xmlPropertyList = UTI(rawValue: kUTTypeXMLPropertyList as String) 400 | static let binaryPropertyList = UTI(rawValue: kUTTypeBinaryPropertyList as String) 401 | static let pdf = UTI(rawValue: kUTTypePDF as String) 402 | static let rtfd = UTI(rawValue: kUTTypeRTFD as String) 403 | static let flatRTFD = UTI(rawValue: kUTTypeFlatRTFD as String) 404 | static let txnTextAndMultimediaData = UTI(rawValue: kUTTypeTXNTextAndMultimediaData as String) 405 | static let webArchive = UTI(rawValue: kUTTypeWebArchive as String) 406 | static let image = UTI(rawValue: kUTTypeImage as String) 407 | static let jpeg = UTI(rawValue: kUTTypeJPEG as String) 408 | static let jpeg2000 = UTI(rawValue: kUTTypeJPEG2000 as String) 409 | static let tiff = UTI(rawValue: kUTTypeTIFF as String) 410 | static let pict = UTI(rawValue: kUTTypePICT as String) 411 | static let gif = UTI(rawValue: kUTTypeGIF as String) 412 | static let png = UTI(rawValue: kUTTypePNG as String) 413 | static let quickTimeImage = UTI(rawValue: kUTTypeQuickTimeImage as String) 414 | static let appleICNS = UTI(rawValue: kUTTypeAppleICNS as String) 415 | static let bmp = UTI(rawValue: kUTTypeBMP as String) 416 | static let ico = UTI(rawValue: kUTTypeICO as String) 417 | static let rawImage = UTI(rawValue: kUTTypeRawImage as String) 418 | static let scalableVectorGraphics = UTI(rawValue: kUTTypeScalableVectorGraphics as String) 419 | @available(OSX 10.12, iOS 9.1, watchOS 2.1, *) 420 | static let livePhoto = UTI(rawValue: kUTTypeLivePhoto as String) 421 | @available(OSX 10.12, iOS 9.1, *) 422 | static let audiovisualContent = UTI(rawValue: kUTTypeAudiovisualContent as String) 423 | static let movie = UTI(rawValue: kUTTypeMovie as String) 424 | static let video = UTI(rawValue: kUTTypeVideo as String) 425 | static let audio = UTI(rawValue: kUTTypeAudio as String) 426 | static let quickTimeMovie = UTI(rawValue: kUTTypeQuickTimeMovie as String) 427 | static let mpeg = UTI(rawValue: kUTTypeMPEG as String) 428 | static let mpeg2Video = UTI(rawValue: kUTTypeMPEG2Video as String) 429 | static let mpeg2TransportStream = UTI(rawValue: kUTTypeMPEG2TransportStream as String) 430 | static let mp3 = UTI(rawValue: kUTTypeMP3 as String) 431 | static let mpeg4 = UTI(rawValue: kUTTypeMPEG4 as String) 432 | static let mpeg4Audio = UTI(rawValue: kUTTypeMPEG4Audio as String) 433 | static let appleProtectedMPEG4Audio = UTI(rawValue: kUTTypeAppleProtectedMPEG4Audio as String) 434 | static let appleProtectedMPEG4Video = UTI(rawValue: kUTTypeAppleProtectedMPEG4Video as String) 435 | static let aviMovie = UTI(rawValue: kUTTypeAVIMovie as String) 436 | static let audioInterchangeFileFormat = UTI(rawValue: kUTTypeAudioInterchangeFileFormat as String) 437 | static let waveformAudio = UTI(rawValue: kUTTypeWaveformAudio as String) 438 | static let midiAudio = UTI(rawValue: kUTTypeMIDIAudio as String) 439 | static let playlist = UTI(rawValue: kUTTypePlaylist as String) 440 | static let m3UPlaylist = UTI(rawValue: kUTTypeM3UPlaylist as String) 441 | static let folder = UTI(rawValue: kUTTypeFolder as String) 442 | static let volume = UTI(rawValue: kUTTypeVolume as String) 443 | static let package = UTI(rawValue: kUTTypePackage as String) 444 | static let bundle = UTI(rawValue: kUTTypeBundle as String) 445 | static let pluginBundle = UTI(rawValue: kUTTypePluginBundle as String) 446 | static let spotlightImporter = UTI(rawValue: kUTTypeSpotlightImporter as String) 447 | static let quickLookGenerator = UTI(rawValue: kUTTypeQuickLookGenerator as String) 448 | static let xpcService = UTI(rawValue: kUTTypeXPCService as String) 449 | static let framework = UTI(rawValue: kUTTypeFramework as String) 450 | static let application = UTI(rawValue: kUTTypeApplication as String) 451 | static let applicationBundle = UTI(rawValue: kUTTypeApplicationBundle as String) 452 | static let applicationFile = UTI(rawValue: kUTTypeApplicationFile as String) 453 | static let unixExecutable = UTI(rawValue: kUTTypeUnixExecutable as String) 454 | static let windowsExecutable = UTI(rawValue: kUTTypeWindowsExecutable as String) 455 | static let javaClass = UTI(rawValue: kUTTypeJavaClass as String) 456 | static let javaArchive = UTI(rawValue: kUTTypeJavaArchive as String) 457 | static let systemPreferencesPane = UTI(rawValue: kUTTypeSystemPreferencesPane as String) 458 | static let gnuZipArchive = UTI(rawValue: kUTTypeGNUZipArchive as String) 459 | static let bzip2Archive = UTI(rawValue: kUTTypeBzip2Archive as String) 460 | static let zipArchive = UTI(rawValue: kUTTypeZipArchive as String) 461 | static let spreadsheet = UTI(rawValue: kUTTypeSpreadsheet as String) 462 | static let presentation = UTI(rawValue: kUTTypePresentation as String) 463 | static let database = UTI(rawValue: kUTTypeDatabase as String) 464 | static let vCard = UTI(rawValue: kUTTypeVCard as String) 465 | static let toDoItem = UTI(rawValue: kUTTypeToDoItem as String) 466 | static let calendarEvent = UTI(rawValue: kUTTypeCalendarEvent as String) 467 | static let emailMessage = UTI(rawValue: kUTTypeEmailMessage as String) 468 | static let internetLocation = UTI(rawValue: kUTTypeInternetLocation as String) 469 | static let inkText = UTI(rawValue: kUTTypeInkText as String) 470 | static let font = UTI(rawValue: kUTTypeFont as String) 471 | static let bookmark = UTI(rawValue: kUTTypeBookmark as String) 472 | static let _3DContent = UTI(rawValue: kUTType3DContent as String) 473 | static let pkcs12 = UTI(rawValue: kUTTypePKCS12 as String) 474 | static let x509Certificate = UTI(rawValue: kUTTypeX509Certificate as String) 475 | static let electronicPublication = UTI(rawValue: kUTTypeElectronicPublication as String) 476 | static let log = UTI(rawValue: kUTTypeLog as String) 477 | static let docx = UTI(rawValue: "org.openxmlformats.wordprocessingml.document") 478 | static let doc = UTI(rawValue: "com.microsoft.word.doc") 479 | } 480 | 481 | #if os(OSX) 482 | 483 | extension OSType { 484 | 485 | 486 | /// Returns the OSType encoded as a String. 487 | 488 | var string: String { 489 | 490 | let unmanagedString = UTCreateStringForOSType(self) 491 | 492 | return unmanagedString.takeRetainedValue() as String 493 | } 494 | 495 | 496 | /// Initializes a OSType from a String. 497 | /// 498 | /// - Parameter string: A String representing an OSType. 499 | 500 | init(with string: String) { 501 | 502 | self = UTGetOSTypeFromString(string as CFString) 503 | } 504 | } 505 | 506 | #endif 507 | --------------------------------------------------------------------------------