From 2bd94f2f1a347297768bbea9f01918cb585c6508 Mon Sep 17 00:00:00 2001 From: redstrate Date: Tue, 10 Mar 2020 14:23:54 -0400 Subject: [PATCH] Add initial files --- .gitignore | 147 ++++ ProcreateViewer.xcodeproj/project.pbxproj | 679 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/swiftpm/Package.resolved | 16 + ProcreateViewer/AppDelegate.swift | 6 + .../AppIcon.appiconset/Contents.json | 58 ++ ProcreateViewer/Assets.xcassets/Contents.json | 6 + ProcreateViewer/Base.lproj/Main.storyboard | 220 ++++++ ProcreateViewer/Document.swift | 39 + ProcreateViewer/Info.plist | 75 ++ ProcreateViewer/ProcreateViewer.entitlements | 10 + ProcreateViewer/ViewController.swift | 12 + .../Base.lproj/PreviewViewController.xib | 34 + Quicklook/Info.plist | 44 ++ Quicklook/PreviewViewController.swift | 47 ++ Quicklook/Quicklook.entitlements | 22 + Thumbnail/Info.plist | 44 ++ Thumbnail/Thumbnail.entitlements | 10 + Thumbnail/ThumbnailProvider.swift | 62 ++ 20 files changed, 1546 insertions(+) create mode 100644 .gitignore create mode 100644 ProcreateViewer.xcodeproj/project.pbxproj create mode 100644 ProcreateViewer.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 ProcreateViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 ProcreateViewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 ProcreateViewer/AppDelegate.swift create mode 100644 ProcreateViewer/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 ProcreateViewer/Assets.xcassets/Contents.json create mode 100644 ProcreateViewer/Base.lproj/Main.storyboard create mode 100644 ProcreateViewer/Document.swift create mode 100644 ProcreateViewer/Info.plist create mode 100644 ProcreateViewer/ProcreateViewer.entitlements create mode 100644 ProcreateViewer/ViewController.swift create mode 100644 Quicklook/Base.lproj/PreviewViewController.xib create mode 100644 Quicklook/Info.plist create mode 100644 Quicklook/PreviewViewController.swift create mode 100644 Quicklook/Quicklook.entitlements create mode 100644 Thumbnail/Info.plist create mode 100644 Thumbnail/Thumbnail.entitlements create mode 100644 Thumbnail/ThumbnailProvider.swift diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8afd41b --- /dev/null +++ b/.gitignore @@ -0,0 +1,147 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +xcschemes/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Gcc Patch +/*.gcno + +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +# .swiftpm + +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ +# +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build/ + +# Accio dependency management +Dependencies/ +.accio/ + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. +# Instead, use fastlane to re-generate the screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk diff --git a/ProcreateViewer.xcodeproj/project.pbxproj b/ProcreateViewer.xcodeproj/project.pbxproj new file mode 100644 index 0000000..865cc8d --- /dev/null +++ b/ProcreateViewer.xcodeproj/project.pbxproj @@ -0,0 +1,679 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + 030F6FF22415C5E300A43F01 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030F6FF12415C5E300A43F01 /* AppDelegate.swift */; }; + 030F6FF42415C5E300A43F01 /* Document.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030F6FF32415C5E300A43F01 /* Document.swift */; }; + 030F6FF92415C5E400A43F01 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 030F6FF82415C5E400A43F01 /* Assets.xcassets */; }; + 030F700B2415C6B500A43F01 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030F700A2415C6B500A43F01 /* Quartz.framework */; }; + 030F700E2415C6B500A43F01 /* PreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030F700D2415C6B500A43F01 /* PreviewViewController.swift */; }; + 030F70112415C6B500A43F01 /* PreviewViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 030F700F2415C6B500A43F01 /* PreviewViewController.xib */; }; + 030F70162415C6B500A43F01 /* QuickLook.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 030F70082415C6B500A43F01 /* QuickLook.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 036AFBB8241687680075400A /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = 036AFBB7241687680075400A /* ZIPFoundation */; }; + 036AFBBA24168C030075400A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 036AFBB924168C030075400A /* ViewController.swift */; }; + 036AFBE32417F0A00075400A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 036AFBE12417F0A00075400A /* Main.storyboard */; }; + 036AFC062417F2990075400A /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = 036AFC052417F2990075400A /* ZIPFoundation */; }; + 036AFC0D241800350075400A /* QuickLookThumbnailing.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 036AFC0C241800350075400A /* QuickLookThumbnailing.framework */; }; + 036AFC0E241800350075400A /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 030F700A2415C6B500A43F01 /* Quartz.framework */; }; + 036AFC11241800350075400A /* ThumbnailProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 036AFC10241800350075400A /* ThumbnailProvider.swift */; }; + 036AFC16241800350075400A /* Thumbnail.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 036AFC0B241800350075400A /* Thumbnail.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 036AFC1B241800850075400A /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = 036AFC1A241800850075400A /* ZIPFoundation */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 030F70142415C6B500A43F01 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 030F6FE62415C5E300A43F01 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 030F70072415C6B500A43F01; + remoteInfo = Quicklook; + }; + 036AFC14241800350075400A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 030F6FE62415C5E300A43F01 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 036AFC0A241800350075400A; + remoteInfo = Thumbnail; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 030F701A2415C6B500A43F01 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 030F70162415C6B500A43F01 /* QuickLook.appex in Embed App Extensions */, + 036AFC16241800350075400A /* Thumbnail.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 030F6FEE2415C5E300A43F01 /* ProcreateViewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ProcreateViewer.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 030F6FF12415C5E300A43F01 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 030F6FF32415C5E300A43F01 /* Document.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Document.swift; sourceTree = ""; }; + 030F6FF82415C5E400A43F01 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 030F6FFD2415C5E400A43F01 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 030F6FFE2415C5E400A43F01 /* ProcreateViewer.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ProcreateViewer.entitlements; sourceTree = ""; }; + 030F70082415C6B500A43F01 /* QuickLook.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = QuickLook.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 030F700A2415C6B500A43F01 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; + 030F700D2415C6B500A43F01 /* PreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewViewController.swift; sourceTree = ""; }; + 030F70102415C6B500A43F01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreviewViewController.xib; sourceTree = ""; }; + 030F70122415C6B500A43F01 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 030F70132415C6B500A43F01 /* Quicklook.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Quicklook.entitlements; sourceTree = ""; }; + 036AFBB924168C030075400A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 036AFBE22417F0A00075400A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 036AFC0B241800350075400A /* Thumbnail.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Thumbnail.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 036AFC0C241800350075400A /* QuickLookThumbnailing.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLookThumbnailing.framework; path = System/Library/Frameworks/QuickLookThumbnailing.framework; sourceTree = SDKROOT; }; + 036AFC10241800350075400A /* ThumbnailProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThumbnailProvider.swift; sourceTree = ""; }; + 036AFC12241800350075400A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 036AFC13241800350075400A /* Thumbnail.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Thumbnail.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 030F6FEB2415C5E300A43F01 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 036AFBB8241687680075400A /* ZIPFoundation in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 030F70052415C6B500A43F01 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 030F700B2415C6B500A43F01 /* Quartz.framework in Frameworks */, + 036AFC062417F2990075400A /* ZIPFoundation in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 036AFC08241800350075400A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 036AFC0D241800350075400A /* QuickLookThumbnailing.framework in Frameworks */, + 036AFC0E241800350075400A /* Quartz.framework in Frameworks */, + 036AFC1B241800850075400A /* ZIPFoundation in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 030F6FE52415C5E300A43F01 = { + isa = PBXGroup; + children = ( + 030F6FF02415C5E300A43F01 /* ProcreateViewer */, + 030F700C2415C6B500A43F01 /* Quicklook */, + 036AFC0F241800350075400A /* Thumbnail */, + 030F70092415C6B500A43F01 /* Frameworks */, + 030F6FEF2415C5E300A43F01 /* Products */, + ); + sourceTree = ""; + }; + 030F6FEF2415C5E300A43F01 /* Products */ = { + isa = PBXGroup; + children = ( + 030F6FEE2415C5E300A43F01 /* ProcreateViewer.app */, + 030F70082415C6B500A43F01 /* QuickLook.appex */, + 036AFC0B241800350075400A /* Thumbnail.appex */, + ); + name = Products; + sourceTree = ""; + }; + 030F6FF02415C5E300A43F01 /* ProcreateViewer */ = { + isa = PBXGroup; + children = ( + 036AFBE12417F0A00075400A /* Main.storyboard */, + 030F6FF12415C5E300A43F01 /* AppDelegate.swift */, + 030F6FF32415C5E300A43F01 /* Document.swift */, + 030F6FF82415C5E400A43F01 /* Assets.xcassets */, + 030F6FFD2415C5E400A43F01 /* Info.plist */, + 030F6FFE2415C5E400A43F01 /* ProcreateViewer.entitlements */, + 036AFBB924168C030075400A /* ViewController.swift */, + ); + path = ProcreateViewer; + sourceTree = ""; + }; + 030F70092415C6B500A43F01 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 030F700A2415C6B500A43F01 /* Quartz.framework */, + 036AFC0C241800350075400A /* QuickLookThumbnailing.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 030F700C2415C6B500A43F01 /* Quicklook */ = { + isa = PBXGroup; + children = ( + 030F700D2415C6B500A43F01 /* PreviewViewController.swift */, + 030F700F2415C6B500A43F01 /* PreviewViewController.xib */, + 030F70122415C6B500A43F01 /* Info.plist */, + 030F70132415C6B500A43F01 /* Quicklook.entitlements */, + ); + path = Quicklook; + sourceTree = ""; + }; + 036AFC0F241800350075400A /* Thumbnail */ = { + isa = PBXGroup; + children = ( + 036AFC10241800350075400A /* ThumbnailProvider.swift */, + 036AFC12241800350075400A /* Info.plist */, + 036AFC13241800350075400A /* Thumbnail.entitlements */, + ); + path = Thumbnail; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 030F6FED2415C5E300A43F01 /* ProcreateViewer */ = { + isa = PBXNativeTarget; + buildConfigurationList = 030F70012415C5E400A43F01 /* Build configuration list for PBXNativeTarget "ProcreateViewer" */; + buildPhases = ( + 030F6FEA2415C5E300A43F01 /* Sources */, + 030F6FEB2415C5E300A43F01 /* Frameworks */, + 030F6FEC2415C5E300A43F01 /* Resources */, + 030F701A2415C6B500A43F01 /* Embed App Extensions */, + ); + buildRules = ( + ); + dependencies = ( + 030F70152415C6B500A43F01 /* PBXTargetDependency */, + 036AFC15241800350075400A /* PBXTargetDependency */, + ); + name = ProcreateViewer; + packageProductDependencies = ( + 036AFBB7241687680075400A /* ZIPFoundation */, + ); + productName = ProcreateViewer; + productReference = 030F6FEE2415C5E300A43F01 /* ProcreateViewer.app */; + productType = "com.apple.product-type.application"; + }; + 030F70072415C6B500A43F01 /* QuickLook */ = { + isa = PBXNativeTarget; + buildConfigurationList = 030F70172415C6B500A43F01 /* Build configuration list for PBXNativeTarget "QuickLook" */; + buildPhases = ( + 030F70042415C6B500A43F01 /* Sources */, + 030F70052415C6B500A43F01 /* Frameworks */, + 030F70062415C6B500A43F01 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = QuickLook; + packageProductDependencies = ( + 036AFC052417F2990075400A /* ZIPFoundation */, + ); + productName = Quicklook; + productReference = 030F70082415C6B500A43F01 /* QuickLook.appex */; + productType = "com.apple.product-type.app-extension"; + }; + 036AFC0A241800350075400A /* Thumbnail */ = { + isa = PBXNativeTarget; + buildConfigurationList = 036AFC17241800350075400A /* Build configuration list for PBXNativeTarget "Thumbnail" */; + buildPhases = ( + 036AFC07241800350075400A /* Sources */, + 036AFC08241800350075400A /* Frameworks */, + 036AFC09241800350075400A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Thumbnail; + packageProductDependencies = ( + 036AFC1A241800850075400A /* ZIPFoundation */, + ); + productName = Thumbnail; + productReference = 036AFC0B241800350075400A /* Thumbnail.appex */; + productType = "com.apple.product-type.app-extension"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 030F6FE62415C5E300A43F01 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = Josh; + TargetAttributes = { + 030F6FED2415C5E300A43F01 = { + CreatedOnToolsVersion = 11.3.1; + }; + 030F70072415C6B500A43F01 = { + CreatedOnToolsVersion = 11.3.1; + }; + 036AFC0A241800350075400A = { + CreatedOnToolsVersion = 11.3.1; + }; + }; + }; + buildConfigurationList = 030F6FE92415C5E300A43F01 /* Build configuration list for PBXProject "ProcreateViewer" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 030F6FE52415C5E300A43F01; + packageReferences = ( + 036AFBB6241687680075400A /* XCRemoteSwiftPackageReference "ZIPFoundation" */, + ); + productRefGroup = 030F6FEF2415C5E300A43F01 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 030F6FED2415C5E300A43F01 /* ProcreateViewer */, + 030F70072415C6B500A43F01 /* QuickLook */, + 036AFC0A241800350075400A /* Thumbnail */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 030F6FEC2415C5E300A43F01 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 030F6FF92415C5E400A43F01 /* Assets.xcassets in Resources */, + 036AFBE32417F0A00075400A /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 030F70062415C6B500A43F01 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 030F70112415C6B500A43F01 /* PreviewViewController.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 036AFC09241800350075400A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 030F6FEA2415C5E300A43F01 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 036AFBBA24168C030075400A /* ViewController.swift in Sources */, + 030F6FF42415C5E300A43F01 /* Document.swift in Sources */, + 030F6FF22415C5E300A43F01 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 030F70042415C6B500A43F01 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 030F700E2415C6B500A43F01 /* PreviewViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 036AFC07241800350075400A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 036AFC11241800350075400A /* ThumbnailProvider.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 030F70152415C6B500A43F01 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 030F70072415C6B500A43F01 /* QuickLook */; + targetProxy = 030F70142415C6B500A43F01 /* PBXContainerItemProxy */; + }; + 036AFC15241800350075400A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 036AFC0A241800350075400A /* Thumbnail */; + targetProxy = 036AFC14241800350075400A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 030F700F2415C6B500A43F01 /* PreviewViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + 030F70102415C6B500A43F01 /* Base */, + ); + name = PreviewViewController.xib; + sourceTree = ""; + }; + 036AFBE12417F0A00075400A /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 036AFBE22417F0A00075400A /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 030F6FFF2415C5E400A43F01 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 030F70002415C5E400A43F01 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 030F70022415C5E400A43F01 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = ProcreateViewer/ProcreateViewer.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = JM5LKVKH48; + INFOPLIST_FILE = ProcreateViewer/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.redstrate.ProcreateViewer; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 030F70032415C5E400A43F01 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = ProcreateViewer/ProcreateViewer.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = JM5LKVKH48; + INFOPLIST_FILE = ProcreateViewer/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.redstrate.ProcreateViewer; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 030F70182415C6B500A43F01 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = Quicklook/Quicklook.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = JM5LKVKH48; + INFOPLIST_FILE = Quicklook/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.redstrate.ProcreateViewer.QuickLook; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 030F70192415C6B500A43F01 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = Quicklook/Quicklook.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = JM5LKVKH48; + INFOPLIST_FILE = Quicklook/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.github.redstrate.ProcreateViewer.QuickLook; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 036AFC18241800350075400A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = Thumbnail/Thumbnail.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = JM5LKVKH48; + INFOPLIST_FILE = Thumbnail/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + PRODUCT_BUNDLE_IDENTIFIER = com.github.redstrate.ProcreateViewer.Thumbnail; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 036AFC19241800350075400A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = Thumbnail/Thumbnail.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = JM5LKVKH48; + INFOPLIST_FILE = Thumbnail/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + PRODUCT_BUNDLE_IDENTIFIER = com.github.redstrate.ProcreateViewer.Thumbnail; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 030F6FE92415C5E300A43F01 /* Build configuration list for PBXProject "ProcreateViewer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 030F6FFF2415C5E400A43F01 /* Debug */, + 030F70002415C5E400A43F01 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 030F70012415C5E400A43F01 /* Build configuration list for PBXNativeTarget "ProcreateViewer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 030F70022415C5E400A43F01 /* Debug */, + 030F70032415C5E400A43F01 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 030F70172415C6B500A43F01 /* Build configuration list for PBXNativeTarget "QuickLook" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 030F70182415C6B500A43F01 /* Debug */, + 030F70192415C6B500A43F01 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 036AFC17241800350075400A /* Build configuration list for PBXNativeTarget "Thumbnail" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 036AFC18241800350075400A /* Debug */, + 036AFC19241800350075400A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 036AFBB6241687680075400A /* XCRemoteSwiftPackageReference "ZIPFoundation" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/weichsel/ZIPFoundation/"; + requirement = { + branch = development; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 036AFBB7241687680075400A /* ZIPFoundation */ = { + isa = XCSwiftPackageProductDependency; + package = 036AFBB6241687680075400A /* XCRemoteSwiftPackageReference "ZIPFoundation" */; + productName = ZIPFoundation; + }; + 036AFC052417F2990075400A /* ZIPFoundation */ = { + isa = XCSwiftPackageProductDependency; + package = 036AFBB6241687680075400A /* XCRemoteSwiftPackageReference "ZIPFoundation" */; + productName = ZIPFoundation; + }; + 036AFC1A241800850075400A /* ZIPFoundation */ = { + isa = XCSwiftPackageProductDependency; + package = 036AFBB6241687680075400A /* XCRemoteSwiftPackageReference "ZIPFoundation" */; + productName = ZIPFoundation; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 030F6FE62415C5E300A43F01 /* Project object */; +} diff --git a/ProcreateViewer.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ProcreateViewer.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ProcreateViewer.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ProcreateViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ProcreateViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ProcreateViewer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ProcreateViewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ProcreateViewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..749c23d --- /dev/null +++ b/ProcreateViewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "ZIPFoundation", + "repositoryURL": "https://github.com/weichsel/ZIPFoundation/", + "state": { + "branch": "development", + "revision": "6696b6811924ac4672ac602fb7efb9dcfd7322cf", + "version": null + } + } + ] + }, + "version": 1 +} diff --git a/ProcreateViewer/AppDelegate.swift b/ProcreateViewer/AppDelegate.swift new file mode 100644 index 0000000..c391a90 --- /dev/null +++ b/ProcreateViewer/AppDelegate.swift @@ -0,0 +1,6 @@ +import Cocoa + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { +} + diff --git a/ProcreateViewer/Assets.xcassets/AppIcon.appiconset/Contents.json b/ProcreateViewer/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/ProcreateViewer/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProcreateViewer/Assets.xcassets/Contents.json b/ProcreateViewer/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/ProcreateViewer/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ProcreateViewer/Base.lproj/Main.storyboard b/ProcreateViewer/Base.lproj/Main.storyboard new file mode 100644 index 0000000..110504d --- /dev/null +++ b/ProcreateViewer/Base.lproj/Main.storyboard @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ProcreateViewer/Document.swift b/ProcreateViewer/Document.swift new file mode 100644 index 0000000..ada6f52 --- /dev/null +++ b/ProcreateViewer/Document.swift @@ -0,0 +1,39 @@ +import Cocoa +import ZIPFoundation + +class Document: NSDocument { + var image: NSImage? + + override init() { + super.init() + } + + override func makeWindowControllers() { + let storyboard = NSStoryboard(name: NSStoryboard.Name("Main"), bundle: nil) + let windowController = storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier("Document Window Controller")) as! NSWindowController + self.addWindowController(windowController) + } + + override func read(from data: Data, ofType typeName: String) throws { + guard let archive = Archive(data: data, accessMode: Archive.AccessMode.read) else { + return + } + + guard let entry = archive["QuickLook/Thumbnail.png"] else { + return + } + + var top_data = Data() + + do { + try archive.extract(entry, consumer: { (d) in + top_data.append(d) + }) + } catch { + Swift.print("Extracting entry from archive failed with error:\(error)") + } + + image = NSImage(data: top_data) + } +} + diff --git a/ProcreateViewer/Info.plist b/ProcreateViewer/Info.plist new file mode 100644 index 0000000..03dcab4 --- /dev/null +++ b/ProcreateViewer/Info.plist @@ -0,0 +1,75 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + CFBundleTypeIconFile + + CFBundleTypeName + Procreate Document + CFBundleTypeRole + Viewer + LSItemContentTypes + + com.procreate + + LSTypeIsPackage + 0 + NSDocumentClass + $(PRODUCT_MODULE_NAME).Document + + + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSApplicationCategoryType + public.app-category.utilities + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2020 Joshua Goins. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + NSSupportsAutomaticTermination + + NSSupportsSuddenTermination + + UTImportedTypeDeclarations + + + UTTypeDescription + Procreate Document + UTTypeIdentifier + com.procreate + UTTypeTagSpecification + + public.filename-extension + + procreate + + + + + + diff --git a/ProcreateViewer/ProcreateViewer.entitlements b/ProcreateViewer/ProcreateViewer.entitlements new file mode 100644 index 0000000..18aff0c --- /dev/null +++ b/ProcreateViewer/ProcreateViewer.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/ProcreateViewer/ViewController.swift b/ProcreateViewer/ViewController.swift new file mode 100644 index 0000000..d14927d --- /dev/null +++ b/ProcreateViewer/ViewController.swift @@ -0,0 +1,12 @@ +import Foundation +import Cocoa + +class ViewController: NSViewController { + @IBOutlet weak var imageView: NSImageView! + + override func viewWillAppear() { + let document = self.view.window?.windowController?.document as? Document + + imageView.image = document?.image + } +} diff --git a/Quicklook/Base.lproj/PreviewViewController.xib b/Quicklook/Base.lproj/PreviewViewController.xib new file mode 100644 index 0000000..d47f49f --- /dev/null +++ b/Quicklook/Base.lproj/PreviewViewController.xib @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Quicklook/Info.plist b/Quicklook/Info.plist new file mode 100644 index 0000000..f7e3046 --- /dev/null +++ b/Quicklook/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Quicklook + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSExtension + + NSExtensionAttributes + + QLSupportedContentTypes + + com.procreate + + QLSupportsSearchableItems + + + NSExtensionPointIdentifier + com.apple.quicklook.preview + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).PreviewViewController + + NSHumanReadableCopyright + Copyright © 2020 Joshua Goins. All rights reserved. + + diff --git a/Quicklook/PreviewViewController.swift b/Quicklook/PreviewViewController.swift new file mode 100644 index 0000000..38bd004 --- /dev/null +++ b/Quicklook/PreviewViewController.swift @@ -0,0 +1,47 @@ +import Cocoa +import Quartz +import ZIPFoundation + +class PreviewViewController: NSViewController, QLPreviewingController { + + @IBOutlet weak var imageView: NSImageView! + + override var nibName: NSNib.Name? { + return NSNib.Name("PreviewViewController") + } + + var image: NSImage? + + func preparePreviewOfFile(at url: URL, completionHandler handler: @escaping (Error?) -> Void) { + let fc: NSFileCoordinator = NSFileCoordinator() + let intent: NSFileAccessIntent = NSFileAccessIntent.readingIntent(with: url) + fc.coordinate(with: [intent], queue: .main) { (err) in + if err == nil { + // No error loading the file? Then continue + do { + let archive = Archive(data: try Data(contentsOf: intent.url), accessMode: Archive.AccessMode.read) + + let entry = archive?["QuickLook/Thumbnail.png"] + var top_data = Data() + + try archive?.extract(entry!, consumer: { (d) in + top_data.append(d) + }) + + self.image = NSImage(data: top_data) + + Swift.print("successfully loaded item " + url.absoluteString) + + self.view.display() + self.imageView?.image = self.image + + handler(nil) + } catch { + NSLog("Could not load file \(intent.url.lastPathComponent) to preview it") + } + } else { + NSLog("Could not find file \(intent.url.lastPathComponent) to preview it") + } + } + } +} diff --git a/Quicklook/Quicklook.entitlements b/Quicklook/Quicklook.entitlements new file mode 100644 index 0000000..648f91e --- /dev/null +++ b/Quicklook/Quicklook.entitlements @@ -0,0 +1,22 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.assets.movies.read-only + + com.apple.security.assets.music.read-only + + com.apple.security.assets.pictures.read-only + + com.apple.security.automation.apple-events + + com.apple.security.files.downloads.read-only + + com.apple.security.files.user-selected.read-only + + com.apple.security.network.client + + + diff --git a/Thumbnail/Info.plist b/Thumbnail/Info.plist new file mode 100644 index 0000000..2f1489a --- /dev/null +++ b/Thumbnail/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Thumbnail + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSExtension + + NSExtensionAttributes + + QLSupportedContentTypes + + com.procreate + + QLThumbnailMinimumDimension + 0 + + NSExtensionPointIdentifier + com.apple.quicklook.thumbnail + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).ThumbnailProvider + + NSHumanReadableCopyright + Copyright © 2020 Joshua Goins. All rights reserved. + + diff --git a/Thumbnail/Thumbnail.entitlements b/Thumbnail/Thumbnail.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/Thumbnail/Thumbnail.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Thumbnail/ThumbnailProvider.swift b/Thumbnail/ThumbnailProvider.swift new file mode 100644 index 0000000..51d6557 --- /dev/null +++ b/Thumbnail/ThumbnailProvider.swift @@ -0,0 +1,62 @@ +import QuickLookThumbnailing +import ZIPFoundation +import Cocoa + +class ThumbnailProvider: QLThumbnailProvider { + override func provideThumbnail(for request: QLFileThumbnailRequest, _ handler: @escaping (QLThumbnailReply?, Error?) -> Void) { + let fc: NSFileCoordinator = NSFileCoordinator() + let intent: NSFileAccessIntent = NSFileAccessIntent.readingIntent(with: request.fileURL) + fc.coordinate(with: [intent], queue: .main) { (err) in + if err == nil { + do { + let archive = Archive(data: try Data(contentsOf: intent.url), accessMode: Archive.AccessMode.read) + + let entry = archive?["QuickLook/Thumbnail.png"] + var top_data = Data() + + try archive?.extract(entry!, consumer: { (d) in + top_data.append(d) + }) + + let image = NSImage(data: top_data) + + let maximumSize = request.maximumSize + let imageSize = image?.size + + var newImageSize = maximumSize + var contextSize = maximumSize + let aspectRatio = imageSize!.height / imageSize!.width + let proposedHeight = aspectRatio * maximumSize.width + + if proposedHeight <= maximumSize.height { + newImageSize.height = proposedHeight + contextSize.height = max(proposedHeight.rounded(.down), request.minimumSize.height) + } else { + newImageSize.width = maximumSize.height / aspectRatio + contextSize.width = max(newImageSize.width.rounded(.down), request.minimumSize.width) + } + + let reply: QLThumbnailReply = QLThumbnailReply.init(contextSize: contextSize) { () -> Bool in + if image != nil { + image!.draw(in: CGRect(x: contextSize.width/2 - newImageSize.width/2, + y: contextSize.height/2 - newImageSize.height/2, + width: newImageSize.width, + height: newImageSize.height)); + + return true + } else { + return false + } + } + handler(reply, nil) + } catch { + NSLog("Could not load file \(intent.url.lastPathComponent) to preview it") + handler(nil, nil) + } + } else { + NSLog("Could not find file \(intent.url.lastPathComponent) to preview it") + handler(nil, nil) + } + } + } +}