├── .gitignore ├── Images ├── 3D-model-example.gif ├── qlPreviewHeader.png └── thumbnails.jpeg ├── LICENSE ├── QLPreviewController.Example ├── QLPreviewController.Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── QLPreviewController.Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Content │ ├── Image_example.jpg │ ├── Keynote_example.key │ ├── PDF_example.pdf │ ├── Pages_example.pages │ ├── Word_example.docx │ └── cup_saucer_set.usdz │ ├── Info.plist │ ├── PreviewCell.swift │ ├── SceneDelegate.swift │ └── ViewController.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | .DS_Store 6 | 7 | ## User settings 8 | xcuserdata/ 9 | 10 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 11 | *.xcscmblueprint 12 | *.xccheckout 13 | 14 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 15 | build/ 16 | DerivedData/ 17 | *.moved-aside 18 | *.pbxuser 19 | !default.pbxuser 20 | *.mode1v3 21 | !default.mode1v3 22 | *.mode2v3 23 | !default.mode2v3 24 | *.perspectivev3 25 | !default.perspectivev3 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | 30 | ## App packaging 31 | *.ipa 32 | *.dSYM.zip 33 | *.dSYM 34 | 35 | ## Playgrounds 36 | timeline.xctimeline 37 | playground.xcworkspace 38 | 39 | # Swift Package Manager 40 | # 41 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 42 | # Packages/ 43 | # Package.pins 44 | # Package.resolved 45 | # *.xcodeproj 46 | # 47 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 48 | # hence it is not needed unless you have added a package configuration file to your project 49 | # .swiftpm 50 | 51 | .build/ 52 | 53 | # CocoaPods 54 | # 55 | # We recommend against adding the Pods directory to your .gitignore. However 56 | # you should judge for yourself, the pros and cons are mentioned at: 57 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 58 | # 59 | # Pods/ 60 | # 61 | # Add this line if you want to avoid checking in source code from the Xcode workspace 62 | # *.xcworkspace 63 | 64 | # Carthage 65 | # 66 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 67 | # Carthage/Checkouts 68 | 69 | Carthage/Build/ 70 | 71 | # Accio dependency management 72 | Dependencies/ 73 | .accio/ 74 | 75 | # fastlane 76 | # 77 | # It is recommended to not store the screenshots in the git repo. 78 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 79 | # For more information about the recommended setup visit: 80 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 81 | 82 | fastlane/report.xml 83 | fastlane/Preview.html 84 | fastlane/screenshots/**/*.png 85 | fastlane/test_output 86 | 87 | # Code Injection 88 | # 89 | # After new code Injection tools there's a generated folder /iOSInjectionProject 90 | # https://github.com/johnno1962/injectionforxcode 91 | 92 | iOSInjectionProject/ 93 | -------------------------------------------------------------------------------- /Images/3D-model-example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/Images/3D-model-example.gif -------------------------------------------------------------------------------- /Images/qlPreviewHeader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/Images/qlPreviewHeader.png -------------------------------------------------------------------------------- /Images/thumbnails.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/Images/thumbnails.jpeg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Filip Němeček 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DC136649242E9CE3002B25CC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC136648242E9CE3002B25CC /* AppDelegate.swift */; }; 11 | DC13664B242E9CE3002B25CC /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC13664A242E9CE3002B25CC /* SceneDelegate.swift */; }; 12 | DC13664D242E9CE3002B25CC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC13664C242E9CE3002B25CC /* ViewController.swift */; }; 13 | DC136650242E9CE3002B25CC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC13664E242E9CE3002B25CC /* Main.storyboard */; }; 14 | DC136652242E9CE6002B25CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC136651242E9CE6002B25CC /* Assets.xcassets */; }; 15 | DC136655242E9CE6002B25CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC136653242E9CE6002B25CC /* LaunchScreen.storyboard */; }; 16 | DC13665F242E9E13002B25CC /* PDF_example.pdf in Resources */ = {isa = PBXBuildFile; fileRef = DC13665E242E9E13002B25CC /* PDF_example.pdf */; }; 17 | DC136661242E9E34002B25CC /* Image_example.jpg in Resources */ = {isa = PBXBuildFile; fileRef = DC136660242E9E34002B25CC /* Image_example.jpg */; }; 18 | DC136666242F3B4D002B25CC /* Pages_example.pages in Resources */ = {isa = PBXBuildFile; fileRef = DC13665D242E9DB7002B25CC /* Pages_example.pages */; }; 19 | DC136668242F3DC7002B25CC /* Word_example.docx in Resources */ = {isa = PBXBuildFile; fileRef = DC136667242F3DC7002B25CC /* Word_example.docx */; }; 20 | DC13666A242F412F002B25CC /* Keynote_example.key in Resources */ = {isa = PBXBuildFile; fileRef = DC136669242F412F002B25CC /* Keynote_example.key */; }; 21 | DC13666C242F41B3002B25CC /* cup_saucer_set.usdz in Resources */ = {isa = PBXBuildFile; fileRef = DC13666B242F41B3002B25CC /* cup_saucer_set.usdz */; }; 22 | DCE54F922439F10400022FB6 /* PreviewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCE54F912439F10400022FB6 /* PreviewCell.swift */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | DC136645242E9CE3002B25CC /* QLPreviewController Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "QLPreviewController Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | DC136648242E9CE3002B25CC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 28 | DC13664A242E9CE3002B25CC /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 29 | DC13664C242E9CE3002B25CC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 30 | DC13664F242E9CE3002B25CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 31 | DC136651242E9CE6002B25CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 32 | DC136654242E9CE6002B25CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 33 | DC136656242E9CE6002B25CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | DC13665D242E9DB7002B25CC /* Pages_example.pages */ = {isa = PBXFileReference; lastKnownFileType = file; path = Pages_example.pages; sourceTree = ""; }; 35 | DC13665E242E9E13002B25CC /* PDF_example.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = PDF_example.pdf; sourceTree = ""; }; 36 | DC136660242E9E34002B25CC /* Image_example.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Image_example.jpg; sourceTree = ""; }; 37 | DC136667242F3DC7002B25CC /* Word_example.docx */ = {isa = PBXFileReference; lastKnownFileType = file; path = Word_example.docx; sourceTree = ""; }; 38 | DC136669242F412F002B25CC /* Keynote_example.key */ = {isa = PBXFileReference; lastKnownFileType = file; path = Keynote_example.key; sourceTree = ""; }; 39 | DC13666B242F41B3002B25CC /* cup_saucer_set.usdz */ = {isa = PBXFileReference; lastKnownFileType = file.usdz; path = cup_saucer_set.usdz; sourceTree = ""; }; 40 | DCE54F912439F10400022FB6 /* PreviewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewCell.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | DC136642242E9CE3002B25CC /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | DC13663C242E9CE3002B25CC = { 55 | isa = PBXGroup; 56 | children = ( 57 | DC136647242E9CE3002B25CC /* QLPreviewController.Example */, 58 | DC136646242E9CE3002B25CC /* Products */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | DC136646242E9CE3002B25CC /* Products */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | DC136645242E9CE3002B25CC /* QLPreviewController Example.app */, 66 | ); 67 | name = Products; 68 | sourceTree = ""; 69 | }; 70 | DC136647242E9CE3002B25CC /* QLPreviewController.Example */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | DC13665C242E9D8D002B25CC /* Content */, 74 | DC136648242E9CE3002B25CC /* AppDelegate.swift */, 75 | DC13664A242E9CE3002B25CC /* SceneDelegate.swift */, 76 | DC13664C242E9CE3002B25CC /* ViewController.swift */, 77 | DCE54F912439F10400022FB6 /* PreviewCell.swift */, 78 | DC13664E242E9CE3002B25CC /* Main.storyboard */, 79 | DC136651242E9CE6002B25CC /* Assets.xcassets */, 80 | DC136653242E9CE6002B25CC /* LaunchScreen.storyboard */, 81 | DC136656242E9CE6002B25CC /* Info.plist */, 82 | ); 83 | path = QLPreviewController.Example; 84 | sourceTree = ""; 85 | }; 86 | DC13665C242E9D8D002B25CC /* Content */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | DC13665D242E9DB7002B25CC /* Pages_example.pages */, 90 | DC13665E242E9E13002B25CC /* PDF_example.pdf */, 91 | DC136660242E9E34002B25CC /* Image_example.jpg */, 92 | DC136667242F3DC7002B25CC /* Word_example.docx */, 93 | DC136669242F412F002B25CC /* Keynote_example.key */, 94 | DC13666B242F41B3002B25CC /* cup_saucer_set.usdz */, 95 | ); 96 | path = Content; 97 | sourceTree = ""; 98 | }; 99 | /* End PBXGroup section */ 100 | 101 | /* Begin PBXNativeTarget section */ 102 | DC136644242E9CE3002B25CC /* QLPreviewController.Example */ = { 103 | isa = PBXNativeTarget; 104 | buildConfigurationList = DC136659242E9CE6002B25CC /* Build configuration list for PBXNativeTarget "QLPreviewController.Example" */; 105 | buildPhases = ( 106 | DC136641242E9CE3002B25CC /* Sources */, 107 | DC136642242E9CE3002B25CC /* Frameworks */, 108 | DC136643242E9CE3002B25CC /* Resources */, 109 | ); 110 | buildRules = ( 111 | ); 112 | dependencies = ( 113 | ); 114 | name = QLPreviewController.Example; 115 | productName = QLPreviewController.Example; 116 | productReference = DC136645242E9CE3002B25CC /* QLPreviewController Example.app */; 117 | productType = "com.apple.product-type.application"; 118 | }; 119 | /* End PBXNativeTarget section */ 120 | 121 | /* Begin PBXProject section */ 122 | DC13663D242E9CE3002B25CC /* Project object */ = { 123 | isa = PBXProject; 124 | attributes = { 125 | LastSwiftUpdateCheck = 1130; 126 | LastUpgradeCheck = 1130; 127 | ORGANIZATIONNAME = "Filip Němeček"; 128 | TargetAttributes = { 129 | DC136644242E9CE3002B25CC = { 130 | CreatedOnToolsVersion = 11.3; 131 | }; 132 | }; 133 | }; 134 | buildConfigurationList = DC136640242E9CE3002B25CC /* Build configuration list for PBXProject "QLPreviewController.Example" */; 135 | compatibilityVersion = "Xcode 9.3"; 136 | developmentRegion = en; 137 | hasScannedForEncodings = 0; 138 | knownRegions = ( 139 | en, 140 | Base, 141 | ); 142 | mainGroup = DC13663C242E9CE3002B25CC; 143 | productRefGroup = DC136646242E9CE3002B25CC /* Products */; 144 | projectDirPath = ""; 145 | projectRoot = ""; 146 | targets = ( 147 | DC136644242E9CE3002B25CC /* QLPreviewController.Example */, 148 | ); 149 | }; 150 | /* End PBXProject section */ 151 | 152 | /* Begin PBXResourcesBuildPhase section */ 153 | DC136643242E9CE3002B25CC /* Resources */ = { 154 | isa = PBXResourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | DC136668242F3DC7002B25CC /* Word_example.docx in Resources */, 158 | DC136661242E9E34002B25CC /* Image_example.jpg in Resources */, 159 | DC13666C242F41B3002B25CC /* cup_saucer_set.usdz in Resources */, 160 | DC13665F242E9E13002B25CC /* PDF_example.pdf in Resources */, 161 | DC13666A242F412F002B25CC /* Keynote_example.key in Resources */, 162 | DC136666242F3B4D002B25CC /* Pages_example.pages in Resources */, 163 | DC136655242E9CE6002B25CC /* LaunchScreen.storyboard in Resources */, 164 | DC136652242E9CE6002B25CC /* Assets.xcassets in Resources */, 165 | DC136650242E9CE3002B25CC /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXSourcesBuildPhase section */ 172 | DC136641242E9CE3002B25CC /* Sources */ = { 173 | isa = PBXSourcesBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | DC13664D242E9CE3002B25CC /* ViewController.swift in Sources */, 177 | DC136649242E9CE3002B25CC /* AppDelegate.swift in Sources */, 178 | DCE54F922439F10400022FB6 /* PreviewCell.swift in Sources */, 179 | DC13664B242E9CE3002B25CC /* SceneDelegate.swift in Sources */, 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | }; 183 | /* End PBXSourcesBuildPhase section */ 184 | 185 | /* Begin PBXVariantGroup section */ 186 | DC13664E242E9CE3002B25CC /* Main.storyboard */ = { 187 | isa = PBXVariantGroup; 188 | children = ( 189 | DC13664F242E9CE3002B25CC /* Base */, 190 | ); 191 | name = Main.storyboard; 192 | sourceTree = ""; 193 | }; 194 | DC136653242E9CE6002B25CC /* LaunchScreen.storyboard */ = { 195 | isa = PBXVariantGroup; 196 | children = ( 197 | DC136654242E9CE6002B25CC /* Base */, 198 | ); 199 | name = LaunchScreen.storyboard; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXVariantGroup section */ 203 | 204 | /* Begin XCBuildConfiguration section */ 205 | DC136657242E9CE6002B25CC /* Debug */ = { 206 | isa = XCBuildConfiguration; 207 | buildSettings = { 208 | ALWAYS_SEARCH_USER_PATHS = NO; 209 | CLANG_ANALYZER_NONNULL = YES; 210 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 211 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 212 | CLANG_CXX_LIBRARY = "libc++"; 213 | CLANG_ENABLE_MODULES = YES; 214 | CLANG_ENABLE_OBJC_ARC = YES; 215 | CLANG_ENABLE_OBJC_WEAK = YES; 216 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 217 | CLANG_WARN_BOOL_CONVERSION = YES; 218 | CLANG_WARN_COMMA = YES; 219 | CLANG_WARN_CONSTANT_CONVERSION = YES; 220 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 221 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 222 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 223 | CLANG_WARN_EMPTY_BODY = YES; 224 | CLANG_WARN_ENUM_CONVERSION = YES; 225 | CLANG_WARN_INFINITE_RECURSION = YES; 226 | CLANG_WARN_INT_CONVERSION = YES; 227 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 228 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 229 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 230 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 231 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 232 | CLANG_WARN_STRICT_PROTOTYPES = YES; 233 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 234 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 235 | CLANG_WARN_UNREACHABLE_CODE = YES; 236 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 237 | COPY_PHASE_STRIP = NO; 238 | DEBUG_INFORMATION_FORMAT = dwarf; 239 | ENABLE_STRICT_OBJC_MSGSEND = YES; 240 | ENABLE_TESTABILITY = YES; 241 | GCC_C_LANGUAGE_STANDARD = gnu11; 242 | GCC_DYNAMIC_NO_PIC = NO; 243 | GCC_NO_COMMON_BLOCKS = YES; 244 | GCC_OPTIMIZATION_LEVEL = 0; 245 | GCC_PREPROCESSOR_DEFINITIONS = ( 246 | "DEBUG=1", 247 | "$(inherited)", 248 | ); 249 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 251 | GCC_WARN_UNDECLARED_SELECTOR = YES; 252 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 253 | GCC_WARN_UNUSED_FUNCTION = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 256 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 257 | MTL_FAST_MATH = YES; 258 | ONLY_ACTIVE_ARCH = YES; 259 | SDKROOT = iphoneos; 260 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 261 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 262 | }; 263 | name = Debug; 264 | }; 265 | DC136658242E9CE6002B25CC /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 271 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 272 | CLANG_CXX_LIBRARY = "libc++"; 273 | CLANG_ENABLE_MODULES = YES; 274 | CLANG_ENABLE_OBJC_ARC = YES; 275 | CLANG_ENABLE_OBJC_WEAK = YES; 276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_COMMA = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INFINITE_RECURSION = YES; 286 | CLANG_WARN_INT_CONVERSION = YES; 287 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 288 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 289 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 290 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 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 = 13.2; 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 | DC13665A242E9CE6002B25CC /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 323 | CODE_SIGN_STYLE = Automatic; 324 | DEVELOPMENT_TEAM = S793P9ET2W; 325 | INFOPLIST_FILE = QLPreviewController.Example/Info.plist; 326 | LD_RUNPATH_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "@executable_path/Frameworks", 329 | ); 330 | PRODUCT_BUNDLE_IDENTIFIER = "FN.QLPreviewController-Example"; 331 | PRODUCT_NAME = "QLPreviewController Example"; 332 | SWIFT_VERSION = 5.0; 333 | TARGETED_DEVICE_FAMILY = "1,2"; 334 | }; 335 | name = Debug; 336 | }; 337 | DC13665B242E9CE6002B25CC /* Release */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 341 | CODE_SIGN_STYLE = Automatic; 342 | DEVELOPMENT_TEAM = S793P9ET2W; 343 | INFOPLIST_FILE = QLPreviewController.Example/Info.plist; 344 | LD_RUNPATH_SEARCH_PATHS = ( 345 | "$(inherited)", 346 | "@executable_path/Frameworks", 347 | ); 348 | PRODUCT_BUNDLE_IDENTIFIER = "FN.QLPreviewController-Example"; 349 | PRODUCT_NAME = "QLPreviewController Example"; 350 | SWIFT_VERSION = 5.0; 351 | TARGETED_DEVICE_FAMILY = "1,2"; 352 | }; 353 | name = Release; 354 | }; 355 | /* End XCBuildConfiguration section */ 356 | 357 | /* Begin XCConfigurationList section */ 358 | DC136640242E9CE3002B25CC /* Build configuration list for PBXProject "QLPreviewController.Example" */ = { 359 | isa = XCConfigurationList; 360 | buildConfigurations = ( 361 | DC136657242E9CE6002B25CC /* Debug */, 362 | DC136658242E9CE6002B25CC /* Release */, 363 | ); 364 | defaultConfigurationIsVisible = 0; 365 | defaultConfigurationName = Release; 366 | }; 367 | DC136659242E9CE6002B25CC /* Build configuration list for PBXNativeTarget "QLPreviewController.Example" */ = { 368 | isa = XCConfigurationList; 369 | buildConfigurations = ( 370 | DC13665A242E9CE6002B25CC /* Debug */, 371 | DC13665B242E9CE6002B25CC /* Release */, 372 | ); 373 | defaultConfigurationIsVisible = 0; 374 | defaultConfigurationName = Release; 375 | }; 376 | /* End XCConfigurationList section */ 377 | }; 378 | rootObject = DC13663D242E9CE3002B25CC /* Project object */; 379 | } 380 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // QLPreviewController.Example 4 | // 5 | // Created by Filip Němeček on 27/03/2020. 6 | // Copyright © 2020 Filip Němeček. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Content/Image_example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/QLPreviewController.Example/QLPreviewController.Example/Content/Image_example.jpg -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Content/Keynote_example.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/QLPreviewController.Example/QLPreviewController.Example/Content/Keynote_example.key -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Content/PDF_example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/QLPreviewController.Example/QLPreviewController.Example/Content/PDF_example.pdf -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Content/Pages_example.pages: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/QLPreviewController.Example/QLPreviewController.Example/Content/Pages_example.pages -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Content/Word_example.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/QLPreviewController.Example/QLPreviewController.Example/Content/Word_example.docx -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Content/cup_saucer_set.usdz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nemecek-filip/QLPreviewController.Example/d35d80526f8083deef30eb43b27925e0fb60df87/QLPreviewController.Example/QLPreviewController.Example/Content/cup_saucer_set.usdz -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/PreviewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PreviewCell.swift 3 | // QLPreviewController.Example 4 | // 5 | // Created by Filip Němeček on 05/04/2020. 6 | // Copyright © 2020 Filip Němeček. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class PreviewCell: UITableViewCell { 12 | @IBOutlet var titleLabel: UILabel! 13 | @IBOutlet var subtitleLabel: UILabel! 14 | @IBOutlet var thumbnailImageView: UIImageView! 15 | 16 | override func awakeFromNib() { 17 | super.awakeFromNib() 18 | // Initialization code 19 | } 20 | 21 | func configure(with preview: Preview) { 22 | titleLabel.text = preview.displayName 23 | subtitleLabel.text = preview.formattedFileName 24 | 25 | if let thumb = preview.thumbnail { 26 | thumbnailImageView.image = thumb 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // QLPreviewController.Example 4 | // 5 | // Created by Filip Němeček on 27/03/2020. 6 | // Copyright © 2020 Filip Němeček. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | guard let _ = (scene as? UIWindowScene) else { return } 21 | } 22 | 23 | func sceneDidDisconnect(_ scene: UIScene) { 24 | // Called as the scene is being released by the system. 25 | // This occurs shortly after the scene enters the background, or when its session is discarded. 26 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 27 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 28 | } 29 | 30 | func sceneDidBecomeActive(_ scene: UIScene) { 31 | // Called when the scene has moved from an inactive state to an active state. 32 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 33 | } 34 | 35 | func sceneWillResignActive(_ scene: UIScene) { 36 | // Called when the scene will move from an active state to an inactive state. 37 | // This may occur due to temporary interruptions (ex. an incoming phone call). 38 | } 39 | 40 | func sceneWillEnterForeground(_ scene: UIScene) { 41 | // Called as the scene transitions from the background to the foreground. 42 | // Use this method to undo the changes made on entering the background. 43 | } 44 | 45 | func sceneDidEnterBackground(_ scene: UIScene) { 46 | // Called as the scene transitions from the foreground to the background. 47 | // Use this method to save data, release shared resources, and store enough scene-specific state information 48 | // to restore the scene back to its current state. 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /QLPreviewController.Example/QLPreviewController.Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // QLPreviewController.Example 4 | // 5 | // Created by Filip Němeček on 27/03/2020. 6 | // Copyright © 2020 Filip Němeček. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import QuickLook 11 | 12 | class ViewController: UITableViewController, QLPreviewControllerDataSource { 13 | 14 | // Image taken from here: https://www.pexels.com/photo/close-up-of-peacock-326900/ 15 | 16 | let previews: [Preview] = [ 17 | Preview(displayName: "Pages document", fileName: "Pages_example", fileExtension: "pages"), 18 | Preview(displayName: "PDF", fileName: "PDF_example", fileExtension: "pdf"), 19 | Preview(displayName: "Image", fileName: "Image_example", fileExtension: "jpg"), 20 | Preview(displayName: "Word document", fileName: "Word_example", fileExtension: "docx"), 21 | Preview(displayName: "Keynote presentation", fileName: "Keynote_example", fileExtension: "key"), 22 | Preview(displayName: "3D model", fileName: "cup_saucer_set", fileExtension: "usdz"), 23 | ].filter({ QLPreviewController.canPreview($0) }) 24 | 25 | let previewVC = QLPreviewController() 26 | 27 | let previewGenerator = QLThumbnailGenerator() 28 | let thumbnailSize = CGSize(width: 60, height: 90) 29 | let scale = UIScreen.main.scale 30 | 31 | override func viewDidLoad() { 32 | super.viewDidLoad() 33 | 34 | previewVC.dataSource = self 35 | 36 | generatePreviews() 37 | } 38 | 39 | func generatePreviews() { 40 | let group = DispatchGroup() 41 | 42 | for preview in self.previews { 43 | guard let url = preview.previewItemURL else { continue } 44 | group.enter() 45 | let request = QLThumbnailGenerator.Request(fileAt: url, size: self.thumbnailSize, scale: self.scale, representationTypes: .all) 46 | 47 | 48 | self.previewGenerator.generateBestRepresentation(for: request) { (thumbnail, error) in 49 | 50 | if let error = error { 51 | print(error.localizedDescription) 52 | } else if let thumb = thumbnail { 53 | preview.thumbnail = thumb.uiImage 54 | } 55 | 56 | group.leave() 57 | } 58 | } 59 | 60 | group.notify(queue: .main) { 61 | self.tableView.reloadData() 62 | } 63 | } 64 | 65 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 66 | return previews.count 67 | } 68 | 69 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 70 | guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? PreviewCell else { 71 | preconditionFailure() 72 | } 73 | 74 | let preview = previews[indexPath.row] 75 | cell.configure(with: preview) 76 | 77 | return cell 78 | } 79 | 80 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 81 | previewVC.currentPreviewItemIndex = indexPath.row 82 | 83 | navigationController?.pushViewController(previewVC, animated: true) 84 | 85 | tableView.deselectRow(at: indexPath, animated: true) 86 | } 87 | 88 | func numberOfPreviewItems(in controller: QLPreviewController) -> Int { 89 | return previews.count 90 | } 91 | 92 | func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { 93 | return previews[index] 94 | } 95 | 96 | @IBAction func gitHubButtonTapped(_ sender: Any) { 97 | UIApplication.shared.open(URL(string: "https://github.com/nemecek-filip")!, options: [:], completionHandler: nil) 98 | } 99 | } 100 | 101 | class Preview: NSObject, QLPreviewItem { 102 | let displayName: String 103 | let fileName: String 104 | let fileExtension: String 105 | 106 | var thumbnail: UIImage? 107 | 108 | init(displayName: String, fileName: String, fileExtension: String) { 109 | self.displayName = displayName 110 | self.fileName = fileName 111 | self.fileExtension = fileExtension 112 | 113 | super.init() 114 | } 115 | 116 | var previewItemTitle: String? { 117 | return displayName 118 | } 119 | 120 | var formattedFileName: String { 121 | return "\(fileName).\(fileExtension)" 122 | } 123 | 124 | var previewItemURL: URL? { 125 | return Bundle.main.url(forResource: fileName, withExtension: fileExtension) 126 | } 127 | } 128 | 129 | extension ViewController { 130 | override func viewWillLayoutSubviews() { 131 | super.viewWillLayoutSubviews() 132 | 133 | if let footer = tableView.tableFooterView { 134 | let newSize = footer.systemLayoutSizeFitting(CGSize(width: tableView.bounds.width, height: 0)) 135 | footer.frame.size.height = newSize.height 136 | } 137 | } 138 | } 139 | 140 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | Dynamic Type • 4 | Event Kit • 5 | Quick Look • 6 | App Ideas • 7 | Keyboard Preview • 8 | Modern Collection Views 9 |

10 |

11 | 12 | ---- 13 | # QLPreviewController Example 14 | 15 | [![Twitter: @nemecek_f](https://img.shields.io/badge/contact-@nemecek_f-blue.svg?style=flat)](https://twitter.com/nemecek_f) 16 | [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/nemecek-filip/QLPreviewController.Example/blob/master/LICENSE) 17 | 18 | ![](Images/qlPreviewHeader.png) 19 | 20 | ### Simple example project showing `QLPreviewController` usage 21 | 22 | This projects shows how to use `QLPreviewController` to preview various files like PDF, image, Word document and more. It shows how to create custom `QLPreviewItem`, how to configure `QLPreviewController` to display multiple files and also how to generate thumbnails with `QLThumbnailGenerator` using the `QLThumbnailGenerator.Request` and method `generateBestRepresentation`. 23 | 24 | ![](Images/thumbnails.jpeg) 25 | 26 | It can even display 3D ARKit models in the `.usdz` 27 | 28 | ![](Images/3D-model-example.gif) --------------------------------------------------------------------------------