├── .gitignore ├── LICENSE ├── PDF-Demo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ └── lan.xcuserdatad │ └── UserInterfaceState.xcuserstate ├── PDF-Demo ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── arrow_down.imageset │ │ ├── Contents.json │ │ └── arrow_down.png │ ├── arrow_right.imageset │ │ ├── Contents.json │ │ └── arrow_right.png │ ├── edit-annotations.imageset │ │ ├── Contents.json │ │ ├── edit-annotations.png │ │ └── edit-annotations@2x.png │ ├── outline.imageset │ │ ├── Contents.json │ │ ├── outline.png │ │ └── outline@2x.png │ ├── search.imageset │ │ ├── Contents.json │ │ ├── search.png │ │ └── search@2x.png │ └── thumbnails.imageset │ │ ├── Contents.json │ │ ├── thumbnails.png │ │ └── thumbnails@2x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── OulineTableViewCell.swift ├── OulineTableViewCell.xib ├── OulineTableviewController.swift ├── OulineTableviewController.xib ├── SearchTableViewController.swift ├── SearchViewCell.swift ├── SearchViewCell.xib ├── ThumbnailGridCell.swift ├── ThumbnailGridCell.xib ├── ThumbnailGridViewController.swift ├── ToolView.swift ├── ToolView.xib ├── ViewController.swift └── sample.pdf ├── README.md └── resources ├── 1.png ├── 2.png ├── 3.png └── 4.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 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 | -------------------------------------------------------------------------------- /PDF-Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3F77F44C1F023BB4000732A9 /* OulineTableviewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F77F44A1F023BB4000732A9 /* OulineTableviewController.swift */; }; 11 | 3F77F44D1F023BB4000732A9 /* OulineTableviewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3F77F44B1F023BB4000732A9 /* OulineTableviewController.xib */; }; 12 | 3FD092361F0D249300D6C96F /* SearchTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FD092351F0D249300D6C96F /* SearchTableViewController.swift */; }; 13 | 3FD092391F0D24BA00D6C96F /* SearchViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FD092371F0D24BA00D6C96F /* SearchViewCell.swift */; }; 14 | 3FD0923A1F0D24BA00D6C96F /* SearchViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3FD092381F0D24BA00D6C96F /* SearchViewCell.xib */; }; 15 | 3FEA86E51F0CF16F00DA7829 /* ThumbnailGridViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEA86E41F0CF16F00DA7829 /* ThumbnailGridViewController.swift */; }; 16 | 3FEA86E81F0CF1AB00DA7829 /* ThumbnailGridCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEA86E61F0CF1AB00DA7829 /* ThumbnailGridCell.swift */; }; 17 | 3FEA86E91F0CF1AB00DA7829 /* ThumbnailGridCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3FEA86E71F0CF1AB00DA7829 /* ThumbnailGridCell.xib */; }; 18 | 3FEBE3051F01E84F00DE2722 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEBE3041F01E84F00DE2722 /* AppDelegate.swift */; }; 19 | 3FEBE3071F01E84F00DE2722 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEBE3061F01E84F00DE2722 /* ViewController.swift */; }; 20 | 3FEBE30A1F01E84F00DE2722 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3FEBE3081F01E84F00DE2722 /* Main.storyboard */; }; 21 | 3FEBE30C1F01E84F00DE2722 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEBE30B1F01E84F00DE2722 /* Assets.xcassets */; }; 22 | 3FEBE30F1F01E84F00DE2722 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3FEBE30D1F01E84F00DE2722 /* LaunchScreen.storyboard */; }; 23 | 3FEBE31E1F02057E00DE2722 /* ToolView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3FEBE31D1F02057E00DE2722 /* ToolView.xib */; }; 24 | 3FEBE3201F0206C600DE2722 /* ToolView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEBE31F1F0206C600DE2722 /* ToolView.swift */; }; 25 | 3FF14BFB24AB2CCE001209ED /* sample.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3FF14BFA24AB2CCE001209ED /* sample.pdf */; }; 26 | 3FFD89EF1F02586C00966CCF /* OulineTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFD89ED1F02586C00966CCF /* OulineTableViewCell.swift */; }; 27 | 3FFD89F01F02586C00966CCF /* OulineTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3FFD89EE1F02586C00966CCF /* OulineTableViewCell.xib */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 3F77F44A1F023BB4000732A9 /* OulineTableviewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OulineTableviewController.swift; sourceTree = ""; }; 32 | 3F77F44B1F023BB4000732A9 /* OulineTableviewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OulineTableviewController.xib; sourceTree = ""; }; 33 | 3FD092351F0D249300D6C96F /* SearchTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTableViewController.swift; sourceTree = ""; }; 34 | 3FD092371F0D24BA00D6C96F /* SearchViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewCell.swift; sourceTree = ""; }; 35 | 3FD092381F0D24BA00D6C96F /* SearchViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SearchViewCell.xib; sourceTree = ""; }; 36 | 3FEA86E41F0CF16F00DA7829 /* ThumbnailGridViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThumbnailGridViewController.swift; sourceTree = ""; }; 37 | 3FEA86E61F0CF1AB00DA7829 /* ThumbnailGridCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThumbnailGridCell.swift; sourceTree = ""; }; 38 | 3FEA86E71F0CF1AB00DA7829 /* ThumbnailGridCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ThumbnailGridCell.xib; sourceTree = ""; }; 39 | 3FEBE3011F01E84F00DE2722 /* PDF-Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "PDF-Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 3FEBE3041F01E84F00DE2722 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | 3FEBE3061F01E84F00DE2722 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 42 | 3FEBE3091F01E84F00DE2722 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | 3FEBE30B1F01E84F00DE2722 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | 3FEBE30E1F01E84F00DE2722 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | 3FEBE3101F01E84F00DE2722 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 3FEBE31D1F02057E00DE2722 /* ToolView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ToolView.xib; sourceTree = ""; }; 47 | 3FEBE31F1F0206C600DE2722 /* ToolView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolView.swift; sourceTree = ""; }; 48 | 3FF14BFA24AB2CCE001209ED /* sample.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = sample.pdf; sourceTree = ""; }; 49 | 3FFD89ED1F02586C00966CCF /* OulineTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OulineTableViewCell.swift; sourceTree = ""; }; 50 | 3FFD89EE1F02586C00966CCF /* OulineTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OulineTableViewCell.xib; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 3FEBE2FE1F01E84F00DE2722 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 3FEBE2F81F01E84F00DE2722 = { 65 | isa = PBXGroup; 66 | children = ( 67 | 3FEBE3031F01E84F00DE2722 /* PDF-Demo */, 68 | 3FEBE3021F01E84F00DE2722 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | 3FEBE3021F01E84F00DE2722 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 3FEBE3011F01E84F00DE2722 /* PDF-Demo.app */, 76 | ); 77 | name = Products; 78 | sourceTree = ""; 79 | }; 80 | 3FEBE3031F01E84F00DE2722 /* PDF-Demo */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 3FEBE3041F01E84F00DE2722 /* AppDelegate.swift */, 84 | 3FEBE3061F01E84F00DE2722 /* ViewController.swift */, 85 | 3FEA86E41F0CF16F00DA7829 /* ThumbnailGridViewController.swift */, 86 | 3FD092351F0D249300D6C96F /* SearchTableViewController.swift */, 87 | 3FD092371F0D24BA00D6C96F /* SearchViewCell.swift */, 88 | 3FD092381F0D24BA00D6C96F /* SearchViewCell.xib */, 89 | 3FEA86E61F0CF1AB00DA7829 /* ThumbnailGridCell.swift */, 90 | 3FEA86E71F0CF1AB00DA7829 /* ThumbnailGridCell.xib */, 91 | 3F77F44A1F023BB4000732A9 /* OulineTableviewController.swift */, 92 | 3F77F44B1F023BB4000732A9 /* OulineTableviewController.xib */, 93 | 3FFD89ED1F02586C00966CCF /* OulineTableViewCell.swift */, 94 | 3FFD89EE1F02586C00966CCF /* OulineTableViewCell.xib */, 95 | 3FEBE31D1F02057E00DE2722 /* ToolView.xib */, 96 | 3FEBE31F1F0206C600DE2722 /* ToolView.swift */, 97 | 3FEBE3081F01E84F00DE2722 /* Main.storyboard */, 98 | 3FEBE30B1F01E84F00DE2722 /* Assets.xcassets */, 99 | 3FEBE30D1F01E84F00DE2722 /* LaunchScreen.storyboard */, 100 | 3FEBE3101F01E84F00DE2722 /* Info.plist */, 101 | 3FF14BFA24AB2CCE001209ED /* sample.pdf */, 102 | ); 103 | path = "PDF-Demo"; 104 | sourceTree = ""; 105 | }; 106 | /* End PBXGroup section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | 3FEBE3001F01E84F00DE2722 /* PDF-Demo */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = 3FEBE3131F01E84F00DE2722 /* Build configuration list for PBXNativeTarget "PDF-Demo" */; 112 | buildPhases = ( 113 | 3FEBE2FD1F01E84F00DE2722 /* Sources */, 114 | 3FEBE2FE1F01E84F00DE2722 /* Frameworks */, 115 | 3FEBE2FF1F01E84F00DE2722 /* Resources */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = "PDF-Demo"; 122 | productName = "PDF-Demo"; 123 | productReference = 3FEBE3011F01E84F00DE2722 /* PDF-Demo.app */; 124 | productType = "com.apple.product-type.application"; 125 | }; 126 | /* End PBXNativeTarget section */ 127 | 128 | /* Begin PBXProject section */ 129 | 3FEBE2F91F01E84F00DE2722 /* Project object */ = { 130 | isa = PBXProject; 131 | attributes = { 132 | LastSwiftUpdateCheck = 0900; 133 | LastUpgradeCheck = 1240; 134 | ORGANIZATIONNAME = com.tzshlyt.demo; 135 | TargetAttributes = { 136 | 3FEBE3001F01E84F00DE2722 = { 137 | CreatedOnToolsVersion = 9.0; 138 | LastSwiftMigration = 1150; 139 | }; 140 | }; 141 | }; 142 | buildConfigurationList = 3FEBE2FC1F01E84F00DE2722 /* Build configuration list for PBXProject "PDF-Demo" */; 143 | compatibilityVersion = "Xcode 8.0"; 144 | developmentRegion = en; 145 | hasScannedForEncodings = 0; 146 | knownRegions = ( 147 | en, 148 | Base, 149 | ); 150 | mainGroup = 3FEBE2F81F01E84F00DE2722; 151 | productRefGroup = 3FEBE3021F01E84F00DE2722 /* Products */; 152 | projectDirPath = ""; 153 | projectRoot = ""; 154 | targets = ( 155 | 3FEBE3001F01E84F00DE2722 /* PDF-Demo */, 156 | ); 157 | }; 158 | /* End PBXProject section */ 159 | 160 | /* Begin PBXResourcesBuildPhase section */ 161 | 3FEBE2FF1F01E84F00DE2722 /* Resources */ = { 162 | isa = PBXResourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | 3FEA86E91F0CF1AB00DA7829 /* ThumbnailGridCell.xib in Resources */, 166 | 3FEBE30F1F01E84F00DE2722 /* LaunchScreen.storyboard in Resources */, 167 | 3FD0923A1F0D24BA00D6C96F /* SearchViewCell.xib in Resources */, 168 | 3FEBE31E1F02057E00DE2722 /* ToolView.xib in Resources */, 169 | 3FF14BFB24AB2CCE001209ED /* sample.pdf in Resources */, 170 | 3FEBE30C1F01E84F00DE2722 /* Assets.xcassets in Resources */, 171 | 3FEBE30A1F01E84F00DE2722 /* Main.storyboard in Resources */, 172 | 3F77F44D1F023BB4000732A9 /* OulineTableviewController.xib in Resources */, 173 | 3FFD89F01F02586C00966CCF /* OulineTableViewCell.xib in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXSourcesBuildPhase section */ 180 | 3FEBE2FD1F01E84F00DE2722 /* Sources */ = { 181 | isa = PBXSourcesBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | 3FEBE3201F0206C600DE2722 /* ToolView.swift in Sources */, 185 | 3F77F44C1F023BB4000732A9 /* OulineTableviewController.swift in Sources */, 186 | 3FEBE3071F01E84F00DE2722 /* ViewController.swift in Sources */, 187 | 3FD092391F0D24BA00D6C96F /* SearchViewCell.swift in Sources */, 188 | 3FEA86E51F0CF16F00DA7829 /* ThumbnailGridViewController.swift in Sources */, 189 | 3FEBE3051F01E84F00DE2722 /* AppDelegate.swift in Sources */, 190 | 3FFD89EF1F02586C00966CCF /* OulineTableViewCell.swift in Sources */, 191 | 3FEA86E81F0CF1AB00DA7829 /* ThumbnailGridCell.swift in Sources */, 192 | 3FD092361F0D249300D6C96F /* SearchTableViewController.swift in Sources */, 193 | ); 194 | runOnlyForDeploymentPostprocessing = 0; 195 | }; 196 | /* End PBXSourcesBuildPhase section */ 197 | 198 | /* Begin PBXVariantGroup section */ 199 | 3FEBE3081F01E84F00DE2722 /* Main.storyboard */ = { 200 | isa = PBXVariantGroup; 201 | children = ( 202 | 3FEBE3091F01E84F00DE2722 /* Base */, 203 | ); 204 | name = Main.storyboard; 205 | sourceTree = ""; 206 | }; 207 | 3FEBE30D1F01E84F00DE2722 /* LaunchScreen.storyboard */ = { 208 | isa = PBXVariantGroup; 209 | children = ( 210 | 3FEBE30E1F01E84F00DE2722 /* Base */, 211 | ); 212 | name = LaunchScreen.storyboard; 213 | sourceTree = ""; 214 | }; 215 | /* End PBXVariantGroup section */ 216 | 217 | /* Begin XCBuildConfiguration section */ 218 | 3FEBE3111F01E84F00DE2722 /* Debug */ = { 219 | isa = XCBuildConfiguration; 220 | buildSettings = { 221 | ALWAYS_SEARCH_USER_PATHS = NO; 222 | CLANG_ANALYZER_NONNULL = YES; 223 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 224 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 225 | CLANG_CXX_LIBRARY = "libc++"; 226 | CLANG_ENABLE_MODULES = YES; 227 | CLANG_ENABLE_OBJC_ARC = YES; 228 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 229 | CLANG_WARN_BOOL_CONVERSION = YES; 230 | CLANG_WARN_COMMA = YES; 231 | CLANG_WARN_CONSTANT_CONVERSION = YES; 232 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 233 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 234 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 235 | CLANG_WARN_EMPTY_BODY = YES; 236 | CLANG_WARN_ENUM_CONVERSION = YES; 237 | CLANG_WARN_INFINITE_RECURSION = YES; 238 | CLANG_WARN_INT_CONVERSION = YES; 239 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 240 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 241 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 242 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 243 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 244 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 245 | CLANG_WARN_STRICT_PROTOTYPES = YES; 246 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 247 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 248 | CLANG_WARN_UNREACHABLE_CODE = YES; 249 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 250 | CODE_SIGN_IDENTITY = "iPhone Developer"; 251 | COPY_PHASE_STRIP = NO; 252 | DEBUG_INFORMATION_FORMAT = dwarf; 253 | ENABLE_STRICT_OBJC_MSGSEND = YES; 254 | ENABLE_TESTABILITY = YES; 255 | GCC_C_LANGUAGE_STANDARD = gnu11; 256 | GCC_DYNAMIC_NO_PIC = NO; 257 | GCC_NO_COMMON_BLOCKS = YES; 258 | GCC_OPTIMIZATION_LEVEL = 0; 259 | GCC_PREPROCESSOR_DEFINITIONS = ( 260 | "DEBUG=1", 261 | "$(inherited)", 262 | ); 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 270 | MTL_ENABLE_DEBUG_INFO = YES; 271 | ONLY_ACTIVE_ARCH = YES; 272 | SDKROOT = iphoneos; 273 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 274 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 275 | }; 276 | name = Debug; 277 | }; 278 | 3FEBE3121F01E84F00DE2722 /* Release */ = { 279 | isa = XCBuildConfiguration; 280 | buildSettings = { 281 | ALWAYS_SEARCH_USER_PATHS = NO; 282 | CLANG_ANALYZER_NONNULL = YES; 283 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 289 | CLANG_WARN_BOOL_CONVERSION = YES; 290 | CLANG_WARN_COMMA = YES; 291 | CLANG_WARN_CONSTANT_CONVERSION = YES; 292 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 293 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 294 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 295 | CLANG_WARN_EMPTY_BODY = YES; 296 | CLANG_WARN_ENUM_CONVERSION = YES; 297 | CLANG_WARN_INFINITE_RECURSION = YES; 298 | CLANG_WARN_INT_CONVERSION = YES; 299 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 300 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 301 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 302 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 303 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 304 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 305 | CLANG_WARN_STRICT_PROTOTYPES = YES; 306 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 307 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 308 | CLANG_WARN_UNREACHABLE_CODE = YES; 309 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 310 | CODE_SIGN_IDENTITY = "iPhone Developer"; 311 | COPY_PHASE_STRIP = NO; 312 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 313 | ENABLE_NS_ASSERTIONS = NO; 314 | ENABLE_STRICT_OBJC_MSGSEND = YES; 315 | GCC_C_LANGUAGE_STANDARD = gnu11; 316 | GCC_NO_COMMON_BLOCKS = YES; 317 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 318 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 319 | GCC_WARN_UNDECLARED_SELECTOR = YES; 320 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 321 | GCC_WARN_UNUSED_FUNCTION = YES; 322 | GCC_WARN_UNUSED_VARIABLE = YES; 323 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 324 | MTL_ENABLE_DEBUG_INFO = NO; 325 | SDKROOT = iphoneos; 326 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 327 | VALIDATE_PRODUCT = YES; 328 | }; 329 | name = Release; 330 | }; 331 | 3FEBE3141F01E84F00DE2722 /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 335 | DEVELOPMENT_TEAM = MZ8SP3X9CP; 336 | INFOPLIST_FILE = "PDF-Demo/Info.plist"; 337 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 338 | PRODUCT_BUNDLE_IDENTIFIER = "com.tzshlyt.demo.PDF-Demo"; 339 | PRODUCT_NAME = "$(TARGET_NAME)"; 340 | SWIFT_VERSION = 5.0; 341 | TARGETED_DEVICE_FAMILY = "1,2"; 342 | }; 343 | name = Debug; 344 | }; 345 | 3FEBE3151F01E84F00DE2722 /* Release */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 349 | DEVELOPMENT_TEAM = MZ8SP3X9CP; 350 | INFOPLIST_FILE = "PDF-Demo/Info.plist"; 351 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 352 | PRODUCT_BUNDLE_IDENTIFIER = "com.tzshlyt.demo.PDF-Demo"; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | SWIFT_VERSION = 5.0; 355 | TARGETED_DEVICE_FAMILY = "1,2"; 356 | }; 357 | name = Release; 358 | }; 359 | /* End XCBuildConfiguration section */ 360 | 361 | /* Begin XCConfigurationList section */ 362 | 3FEBE2FC1F01E84F00DE2722 /* Build configuration list for PBXProject "PDF-Demo" */ = { 363 | isa = XCConfigurationList; 364 | buildConfigurations = ( 365 | 3FEBE3111F01E84F00DE2722 /* Debug */, 366 | 3FEBE3121F01E84F00DE2722 /* Release */, 367 | ); 368 | defaultConfigurationIsVisible = 0; 369 | defaultConfigurationName = Release; 370 | }; 371 | 3FEBE3131F01E84F00DE2722 /* Build configuration list for PBXNativeTarget "PDF-Demo" */ = { 372 | isa = XCConfigurationList; 373 | buildConfigurations = ( 374 | 3FEBE3141F01E84F00DE2722 /* Debug */, 375 | 3FEBE3151F01E84F00DE2722 /* Release */, 376 | ); 377 | defaultConfigurationIsVisible = 0; 378 | defaultConfigurationName = Release; 379 | }; 380 | /* End XCConfigurationList section */ 381 | }; 382 | rootObject = 3FEBE2F91F01E84F00DE2722 /* Project object */; 383 | } 384 | -------------------------------------------------------------------------------- /PDF-Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PDF-Demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /PDF-Demo.xcodeproj/project.xcworkspace/xcuserdata/lan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo.xcodeproj/project.xcworkspace/xcuserdata/lan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /PDF-Demo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | 2 | // AppDelegate.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/6/27. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /PDF-Demo/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 | } -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/arrow_down.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "arrow_down.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/arrow_down.imageset/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/arrow_down.imageset/arrow_down.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/arrow_right.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "arrow_right.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/arrow_right.imageset/arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/arrow_right.imageset/arrow_right.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/edit-annotations.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "edit-annotations.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "edit-annotations@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/edit-annotations.imageset/edit-annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/edit-annotations.imageset/edit-annotations.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/edit-annotations.imageset/edit-annotations@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/edit-annotations.imageset/edit-annotations@2x.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/outline.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "outline.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "outline@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/outline.imageset/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/outline.imageset/outline.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/outline.imageset/outline@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/outline.imageset/outline@2x.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/search.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "search.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "search@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/search.imageset/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/search.imageset/search.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/search.imageset/search@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/search.imageset/search@2x.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/thumbnails.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "thumbnails.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "thumbnails@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/thumbnails.imageset/thumbnails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/thumbnails.imageset/thumbnails.png -------------------------------------------------------------------------------- /PDF-Demo/Assets.xcassets/thumbnails.imageset/thumbnails@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/Assets.xcassets/thumbnails.imageset/thumbnails@2x.png -------------------------------------------------------------------------------- /PDF-Demo/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 | 27 | 28 | -------------------------------------------------------------------------------- /PDF-Demo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /PDF-Demo/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /PDF-Demo/OulineTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OulineTableViewCell.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/6/27. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class OulineTableViewCell: UITableViewCell { 12 | 13 | @IBOutlet weak var leftOffset: NSLayoutConstraint! 14 | @IBOutlet open weak var openBtn: UIButton! 15 | @IBOutlet open weak var textLab: UILabel! 16 | @IBOutlet weak var pageLab: UILabel! 17 | 18 | var openBtnClick:((_ sender: UIButton) -> Void)? 19 | 20 | override func layoutSubviews() { 21 | super.layoutSubviews() 22 | if indentationLevel == 0 { 23 | textLab.font = UIFont.systemFont(ofSize: 17) 24 | } else { 25 | textLab.font = UIFont.systemFont(ofSize: 15) 26 | } 27 | leftOffset.constant = CGFloat(indentationWidth * CGFloat(indentationLevel)) 28 | } 29 | 30 | override func awakeFromNib() { 31 | super.awakeFromNib() 32 | // Initialization code 33 | } 34 | 35 | override func setSelected(_ selected: Bool, animated: Bool) { 36 | super.setSelected(selected, animated: animated) 37 | } 38 | 39 | @IBAction func openBtnClick(_ sender: UIButton) { 40 | sender.isSelected = !sender.isSelected 41 | openBtnClick?(sender) 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /PDF-Demo/OulineTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 32 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /PDF-Demo/OulineTableviewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OulineTableviewController.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/6/27. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PDFKit 11 | 12 | protocol OulineTableviewControllerDelegate: AnyObject { 13 | func oulineTableviewController(_ oulineTableviewController: OulineTableviewController, 14 | didSelectOutline outline: PDFOutline) 15 | } 16 | 17 | class OulineTableviewController: UITableViewController { 18 | weak var delegate: OulineTableviewControllerDelegate? 19 | 20 | var pdfOutlineRoot: PDFOutline? { 21 | didSet{ 22 | for index in 0...(pdfOutlineRoot?.numberOfChildren)!-1 { 23 | let pdfOutline = pdfOutlineRoot?.child(at: index) 24 | pdfOutline?.isOpen = false 25 | data.append(pdfOutline!) 26 | } 27 | tableView.reloadData() 28 | } 29 | } 30 | 31 | private var data = [PDFOutline]() 32 | 33 | override func viewDidLoad() { 34 | super.viewDidLoad() 35 | 36 | navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, 37 | target: self, 38 | action: #selector(closeBtnClick)) 39 | tableView.register(UINib(nibName: "OulineTableViewCell", bundle: nil), 40 | forCellReuseIdentifier: "OulineTableViewCell") 41 | tableView.dataSource = self 42 | tableView.delegate = self 43 | } 44 | 45 | @objc func closeBtnClick(sender: UIBarButtonItem) { 46 | dismiss(animated: false, completion: nil) 47 | } 48 | 49 | override func didReceiveMemoryWarning() { 50 | super.didReceiveMemoryWarning() 51 | // Dispose of any resources that can be recreated. 52 | } 53 | } 54 | 55 | extension OulineTableviewController { 56 | override func numberOfSections(in tableView: UITableView) -> Int { 57 | return 1 58 | } 59 | 60 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 61 | return data.count 62 | } 63 | 64 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 65 | let cell = tableView.dequeueReusableCell(withIdentifier: "OulineTableViewCell", for: indexPath) as! OulineTableViewCell 66 | 67 | let outline = data[indexPath.row]; 68 | 69 | cell.textLab.text = outline.label 70 | cell.pageLab.text = outline.destination?.page?.label 71 | 72 | if outline.numberOfChildren > 0 { 73 | cell.openBtn.setImage(outline.isOpen ? #imageLiteral(resourceName: "arrow_down") : #imageLiteral(resourceName: "arrow_right"), for: .normal) 74 | cell.openBtn.isEnabled = true 75 | } else { 76 | cell.openBtn.setImage(nil, for: .normal) 77 | cell.openBtn.isEnabled = false 78 | } 79 | 80 | cell.openBtnClick = {[weak self] (sender)-> Void in 81 | if outline.numberOfChildren > 0 { 82 | if sender.isSelected { 83 | outline.isOpen = true 84 | self?.insertChirchen(parent: outline) 85 | } else { 86 | outline.isOpen = false 87 | self?.removeChildren(parent: outline) 88 | } 89 | tableView.reloadData() 90 | } 91 | } 92 | return cell 93 | } 94 | 95 | override func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath) -> Int { 96 | let outline = data[indexPath.row]; 97 | let depth = findDepth(outline: outline) 98 | return depth; 99 | } 100 | 101 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 102 | let outline = data[indexPath.row] 103 | delegate?.oulineTableviewController(self, didSelectOutline: outline) 104 | dismiss(animated: false, completion: nil) 105 | } 106 | 107 | func findDepth(outline: PDFOutline) -> Int { 108 | var depth: Int = -1 109 | var tmp = outline 110 | while (tmp.parent != nil) { 111 | depth = depth + 1 112 | tmp = tmp.parent! 113 | } 114 | return depth 115 | } 116 | 117 | func insertChirchen(parent: PDFOutline) { 118 | var tmpData: [PDFOutline] = [] 119 | let baseIndex = self.data.firstIndex(of: parent) 120 | for index in 0.. 0 { 137 | removeChildren(parent: node) 138 | // remove self 139 | if let i = data.firstIndex(of: node) { 140 | data.remove(at: i) 141 | } 142 | } else { 143 | if self.data.contains(node) { 144 | if let i = data.firstIndex(of: node) { 145 | data.remove(at: i) 146 | } 147 | } 148 | } 149 | } 150 | } 151 | } 152 | } 153 | 154 | 155 | -------------------------------------------------------------------------------- /PDF-Demo/OulineTableviewController.xib: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /PDF-Demo/SearchTableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SearchTableViewController.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/7/5. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PDFKit 11 | 12 | protocol SearchTableViewControllerDelegate: AnyObject { 13 | func searchTableViewController(_ searchTableViewController: SearchTableViewController, didSelectSerchResult selection: PDFSelection) 14 | } 15 | 16 | class SearchTableViewController: UITableViewController { 17 | var pdfDocument: PDFDocument? 18 | weak var delegate: SearchTableViewControllerDelegate? 19 | 20 | private var searchBar = UISearchBar() 21 | private var searchResults = [PDFSelection]() 22 | 23 | override func viewDidLoad() { 24 | super.viewDidLoad() 25 | 26 | tableView.rowHeight = 150 27 | 28 | searchBar.delegate = self 29 | searchBar.showsCancelButton = true 30 | searchBar.searchBarStyle = .minimal 31 | navigationItem.titleView = searchBar 32 | 33 | tableView.register(UINib(nibName: "SearchViewCell", bundle: nil), forCellReuseIdentifier: "SearchViewCell") 34 | } 35 | 36 | override func viewWillAppear(_ animated: Bool) { 37 | super.viewWillAppear(animated) 38 | searchBar.becomeFirstResponder() 39 | } 40 | 41 | override func didReceiveMemoryWarning() { 42 | super.didReceiveMemoryWarning() 43 | // Dispose of any resources that can be recreated. 44 | } 45 | 46 | // MARK: - Table view data source 47 | override func numberOfSections(in tableView: UITableView) -> Int { 48 | // #warning Incomplete implementation, return the number of sections 49 | return 1 50 | } 51 | 52 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 53 | // #warning Incomplete implementation, return the number of rows 54 | return searchResults.count 55 | } 56 | 57 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 58 | let cell = tableView.dequeueReusableCell(withIdentifier: "SearchViewCell", for: indexPath) as! SearchViewCell 59 | 60 | let selection = searchResults[indexPath.row] 61 | let page = selection.pages[0] 62 | let outline = pdfDocument?.outlineItem(for: selection) 63 | 64 | let outlintstr = outline?.label ?? "" 65 | let pagestr = page.label ?? "" 66 | let txt = outlintstr + " 页码: " + pagestr 67 | cell.destinationLabel.text = txt 68 | 69 | let extendSelection = selection.copy() as! PDFSelection 70 | extendSelection.extend(atStart: 10) 71 | extendSelection.extend(atEnd: 90) 72 | extendSelection.extendForLineBoundaries() 73 | 74 | let range = (extendSelection.string! as NSString).range(of: selection.string!, options: .caseInsensitive) 75 | let attrstr = NSMutableAttributedString(string: extendSelection.string!) 76 | attrstr.addAttribute(.backgroundColor, value: UIColor.yellow, range: range) 77 | 78 | cell.resultTextLabel.attributedText = attrstr 79 | 80 | return cell 81 | } 82 | 83 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 84 | let selection = searchResults[indexPath.row] 85 | 86 | delegate?.searchTableViewController(self, didSelectSerchResult: selection) 87 | dismiss(animated: false, completion: nil) 88 | } 89 | 90 | override func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { 91 | searchBar.resignFirstResponder() 92 | } 93 | } 94 | 95 | extension SearchTableViewController: UISearchBarDelegate { 96 | func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { 97 | searchBar.resignFirstResponder() 98 | } 99 | 100 | func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { 101 | pdfDocument?.cancelFindString() 102 | dismiss(animated: false, completion: nil) 103 | } 104 | 105 | func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { 106 | guard searchText.count >= 2 else { return } 107 | 108 | searchResults.removeAll() 109 | tableView.reloadData() 110 | pdfDocument?.cancelFindString() 111 | pdfDocument?.delegate = self 112 | pdfDocument?.beginFindString(searchText, withOptions: .caseInsensitive) 113 | } 114 | } 115 | 116 | extension SearchTableViewController: PDFDocumentDelegate { 117 | func didMatchString(_ instance: PDFSelection) { 118 | searchResults.append(instance) 119 | tableView.reloadData() 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /PDF-Demo/SearchViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SearchViewCell.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/7/5. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SearchViewCell: UITableViewCell { 12 | 13 | @IBOutlet weak var destinationLabel: UILabel! 14 | @IBOutlet weak var resultTextLabel: UILabel! 15 | 16 | override func awakeFromNib() { 17 | super.awakeFromNib() 18 | // Initialization code 19 | } 20 | 21 | override func setSelected(_ selected: Bool, animated: Bool) { 22 | super.setSelected(selected, animated: animated) 23 | 24 | // Configure the view for the selected state 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /PDF-Demo/SearchViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /PDF-Demo/ThumbnailGridCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThumbnailGridCell.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/7/5. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ThumbnailGridCell: UICollectionViewCell { 12 | 13 | var image: UIImage? = nil { 14 | didSet { 15 | imageView.image = image 16 | } 17 | } 18 | 19 | @IBOutlet weak var imageView: UIImageView! 20 | @IBOutlet weak var pageLab: UILabel! 21 | 22 | override func awakeFromNib() { 23 | super.awakeFromNib() 24 | // Initialization code 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /PDF-Demo/ThumbnailGridCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /PDF-Demo/ThumbnailGridViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThumbnailGridViewController.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/7/5. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PDFKit 11 | 12 | protocol ThumbnailGridViewControllerDelegate: class{ 13 | func thumbnailGridViewController(_ thumbnailGridViewController: ThumbnailGridViewController, didSelectPage page: PDFPage) 14 | } 15 | 16 | class ThumbnailGridViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout { 17 | var pdfDocument: PDFDocument? 18 | weak var delegate: ThumbnailGridViewControllerDelegate? 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, 23 | target: self, 24 | action: #selector(closeBtnClick)) 25 | 26 | // Register cell classes 27 | collectionView?.register(UINib(nibName: "ThumbnailGridCell", bundle: nil), 28 | forCellWithReuseIdentifier: "ThumbnailGridCell") 29 | collectionView?.backgroundColor = UIColor.gray 30 | } 31 | 32 | @objc func closeBtnClick(sender: UIBarButtonItem) { 33 | dismiss(animated: false, completion: nil) 34 | } 35 | 36 | override func didReceiveMemoryWarning() { 37 | super.didReceiveMemoryWarning() 38 | // Dispose of any resources that can be recreated. 39 | } 40 | } 41 | 42 | extension ThumbnailGridViewController { 43 | override func numberOfSections(in collectionView: UICollectionView) -> Int { 44 | return 1 45 | } 46 | 47 | override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 48 | return pdfDocument?.pageCount ?? 0 49 | } 50 | 51 | override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 52 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ThumbnailGridCell", for: indexPath) as! ThumbnailGridCell 53 | 54 | if let page = pdfDocument?.page(at: indexPath.item) { 55 | let thumbnail = page.thumbnail(of: cell.bounds.size, for: PDFDisplayBox.cropBox) 56 | cell.image = thumbnail 57 | cell.pageLab.text = page.label 58 | } 59 | 60 | return cell 61 | } 62 | 63 | override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 64 | if let page = pdfDocument?.page(at: indexPath.item) { 65 | dismiss(animated: false, completion: nil) 66 | delegate?.thumbnailGridViewController(self, didSelectPage: page) 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /PDF-Demo/ToolView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // toolView.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/6/27. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ToolView: UIView { 12 | 13 | @IBOutlet weak var thumbBtn: UIButton! 14 | @IBOutlet weak var outlineBtn: UIButton! 15 | @IBOutlet weak var searchBtn: UIButton! 16 | @IBOutlet weak var editBtn: UIButton! 17 | 18 | class func instanceFromNib() -> ToolView { 19 | return UINib(nibName: "ToolView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! ToolView 20 | } 21 | 22 | override func draw(_ rect: CGRect) { 23 | super.draw(rect) 24 | layer.borderWidth = 1 25 | layer.borderColor = UIColor.black.cgColor 26 | layer.cornerRadius = 5 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /PDF-Demo/ToolView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 27 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /PDF-Demo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // PDF-Demo 4 | // 5 | // Created by lan on 2017/6/27. 6 | // Copyright © 2017年 com.tzshlyt.demo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import PDFKit 11 | 12 | class ViewController: UIViewController { 13 | private var pdfdocument: PDFDocument? 14 | 15 | private var pdfview: PDFView! 16 | private var pdfThumbView: PDFThumbnailView! 17 | private lazy var toolView = ToolView.instanceFromNib() 18 | private weak var observe : NSObjectProtocol? 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | 23 | pdfview = PDFView() 24 | 25 | let url = Bundle.main.url(forResource: "sample", withExtension: "pdf") 26 | pdfdocument = PDFDocument(url: url!) 27 | 28 | pdfview.document = pdfdocument 29 | pdfview.displayMode = .singlePageContinuous 30 | pdfview.autoScales = true 31 | view.addSubview(pdfview) 32 | 33 | pdfThumbView = PDFThumbnailView() 34 | pdfThumbView.layoutMode = .horizontal 35 | pdfThumbView.pdfView = pdfview 36 | pdfThumbView.backgroundColor = UIColor.red 37 | view.addSubview(pdfThumbView) 38 | 39 | view.addSubview(toolView) 40 | toolView.bringSubviewToFront(view) 41 | 42 | toolView.thumbBtn.addTarget(self, action: #selector(thumbBtnClick), for: .touchUpInside) 43 | toolView.outlineBtn.addTarget(self, action: #selector(outlineBtnClick), for: .touchUpInside) 44 | toolView.searchBtn.addTarget(self, action: #selector(searchBtnClick), for: .touchUpInside) 45 | 46 | pdfThumbView.translatesAutoresizingMaskIntoConstraints = false 47 | pdfThumbView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor).isActive = true 48 | pdfThumbView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor).isActive = true 49 | pdfThumbView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true 50 | pdfThumbView.heightAnchor.constraint(equalToConstant: 50).isActive = true 51 | 52 | toolView.translatesAutoresizingMaskIntoConstraints = false 53 | toolView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 10).isActive = true 54 | toolView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -10).isActive = true 55 | toolView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true 56 | toolView.heightAnchor.constraint(equalToConstant: 50).isActive = true 57 | 58 | pdfview.translatesAutoresizingMaskIntoConstraints = false 59 | pdfview.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor).isActive = true 60 | pdfview.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor).isActive = true 61 | pdfview.topAnchor.constraint(equalTo: pdfThumbView.bottomAnchor, constant: 0).isActive = true 62 | pdfview.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true 63 | 64 | let tapgesture = UITapGestureRecognizer(target: self, action: #selector(tapGesture(_:))) 65 | view.addGestureRecognizer(tapgesture) 66 | } 67 | 68 | @objc func tapGesture(_ gestureRecognizer: UITapGestureRecognizer) { 69 | UIView.animate(withDuration: CATransaction.animationDuration()) { 70 | self.toolView.alpha = 1 - self.toolView.alpha 71 | } 72 | } 73 | 74 | @objc func thumbBtnClick(sender: UIButton!) { 75 | let layout = UICollectionViewFlowLayout() 76 | layout.minimumInteritemSpacing = 10 77 | layout.minimumLineSpacing = 20 78 | 79 | let width = (view.frame.width - 10 * 4) / 3 80 | let height = width * 1.5 81 | 82 | layout.itemSize = CGSize(width: width, height: height) 83 | layout.sectionInset = UIEdgeInsets.init(top: 10, left: 10, bottom: 10, right: 10) 84 | 85 | let thumbnailGridViewController = ThumbnailGridViewController(collectionViewLayout: layout) 86 | thumbnailGridViewController.pdfDocument = pdfdocument 87 | thumbnailGridViewController.delegate = self 88 | 89 | let nav = UINavigationController(rootViewController: thumbnailGridViewController) 90 | present(nav, animated: false, completion:nil) 91 | } 92 | 93 | @objc func outlineBtnClick(sender: UIButton) { 94 | 95 | if let pdfoutline = pdfdocument?.outlineRoot { 96 | let oulineViewController = OulineTableviewController(style: UITableView.Style.plain) 97 | oulineViewController.pdfOutlineRoot = pdfoutline 98 | oulineViewController.delegate = self 99 | 100 | let nav = UINavigationController(rootViewController: oulineViewController) 101 | self.present(nav, animated: false, completion:nil) 102 | } 103 | } 104 | 105 | @objc func searchBtnClick(sender: UIButton) { 106 | let searchViewController = SearchTableViewController() 107 | searchViewController.pdfDocument = pdfdocument 108 | searchViewController.delegate = self 109 | 110 | let nav = UINavigationController(rootViewController: searchViewController) 111 | self.present(nav, animated: false, completion:nil) 112 | } 113 | 114 | override func didReceiveMemoryWarning() { 115 | super.didReceiveMemoryWarning() 116 | // Dispose of any resources that can be recreated. 117 | } 118 | } 119 | 120 | extension ViewController: OulineTableviewControllerDelegate { 121 | func oulineTableviewController(_ oulineTableviewController: OulineTableviewController, didSelectOutline outline: PDFOutline) { 122 | let action = outline.action 123 | if let actiongoto = action as? PDFActionGoTo { 124 | pdfview.go(to: actiongoto.destination) 125 | } 126 | } 127 | } 128 | 129 | extension ViewController: ThumbnailGridViewControllerDelegate { 130 | func thumbnailGridViewController(_ thumbnailGridViewController: ThumbnailGridViewController, didSelectPage page: PDFPage) { 131 | pdfview.go(to: page) 132 | } 133 | } 134 | 135 | extension ViewController: SearchTableViewControllerDelegate { 136 | func searchTableViewController(_ searchTableViewController: SearchTableViewController, didSelectSerchResult selection: PDFSelection) { 137 | selection.color = UIColor.yellow 138 | pdfview.currentSelection = selection 139 | pdfview.go(to: selection) 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /PDF-Demo/sample.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/PDF-Demo/sample.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS11-PDFKit-Example 2 | 3 | ![Xcode 9 beta 1](https://img.shields.io/badge/Xcode-9%20beta%201-0080FF.svg) ![Swift 5](https://img.shields.io/badge/Swift-5-yellow.svg) ![iOS 11 beta 1](https://img.shields.io/badge/iOS-11%20beta%201-green.svg) 4 | 5 | Code example for PDFKit on iOS 11. 6 | 7 | **Note**: The project requires Xcode 9 Beta 1 or later, Swift 4 and iOS 11. 8 | 9 | 10 | ## Contents 11 | 12 | ### [PDFKit](https://developer.apple.com/documentation/pdfkit) 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ## Author 24 | 25 | ytlan0201@gmail.com 26 | 27 | ## License 28 | 29 | MIT -------------------------------------------------------------------------------- /resources/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/resources/1.png -------------------------------------------------------------------------------- /resources/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/resources/2.png -------------------------------------------------------------------------------- /resources/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/resources/3.png -------------------------------------------------------------------------------- /resources/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tzshlyt/iOS11-PDFKit-Example/3cddfca90c9a73d986ebdac404cbec5a315e5d62/resources/4.png --------------------------------------------------------------------------------