Skip to content

QuickLook iOS xcode13.0 beta1

Rachel Kang edited this page Aug 3, 2021 · 3 revisions

#QuickLook.framework https://github.com/xamarin/xamarin-macios/pull/12337

diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLFilePreviewRequest.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLFilePreviewRequest.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLFilePreviewRequest.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLFilePreviewRequest.h	2021-06-02 12:48:19.000000000 -0400
@@ -0,0 +1,32 @@
+//
+//  QLFilePreviewRequest.h
+//  QuickLook
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#include <QuickLook/QLBase.h>
+
+#if !defined(USE_PUBLIC_QUICKLOOK_HEADERS) && !defined(USE_PUBLIC_QUICKLOOK_HEADERS_CATALYST) && __has_include(<QuickLookSupport/QLPreviewReply.h>)
+#import <QuickLookSupport/QLFilePreviewRequest.h>
+#else
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ @abstract This class contains information about the preview that should be provided.
+ */
+API_AVAILABLE(ios(15.0), macos(12.0)) API_UNAVAILABLE(watchos,tvos)  __attribute__((visibility("default")))
+QL_EXPORT @interface QLFilePreviewRequest : NSObject
+
+/**
+ The url of the file for which a preview is being requested.
+ */
+@property (readonly) NSURL* fileURL;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewController.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewController.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewController.h	2021-03-16 09:56:41.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewController.h	2021-06-02 12:45:20.000000000 -0400
@@ -23,7 +23,7 @@
 + (BOOL)canPreviewItem:(id <QLPreviewItem>)item;
 
 /*
- * Acessing the previewed items
+ * Accessing the previewed items
  */
 
 /*!
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewProvider.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewProvider.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewProvider.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewProvider.h	2021-06-02 12:48:19.000000000 -0400
@@ -0,0 +1,27 @@
+//
+//  QLPreviewProvider.h
+//  QuickLook
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#if !defined(USE_PUBLIC_QUICKLOOK_HEADERS) && !defined(USE_PUBLIC_QUICKLOOK_HEADERS_CATALYST) && __has_include(<QuickLookSupport/QLPreviewReply.h>)
+#import <QuickLookSupport/QLPreviewProvider.h>
+#else
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ @abstract Data-based preview extensions should subclass QLPreviewProvider in their principal object. The subclass should conform to QLPreviewingController.
+ 
+ */
+API_AVAILABLE(ios(15.0), macos(12.0)) API_UNAVAILABLE(watchos,tvos)  __attribute__((visibility("default")))
+@interface QLPreviewProvider : NSObject <NSExtensionRequestHandling>
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewReply.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewReply.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewReply.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewReply.h	2021-06-02 12:45:20.000000000 -0400
@@ -0,0 +1,106 @@
+//
+//  QLPreviewReply.h
+//  Quick Look
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#if !defined(USE_PUBLIC_QUICKLOOK_HEADERS) && !defined(USE_PUBLIC_QUICKLOOK_HEADERS_CATALYST) && __has_include(<QuickLookSupport/QLPreviewReply.h>)
+#import <QuickLookSupport/QLPreviewReply.h>
+#else
+
+#import <Foundation/Foundation.h>
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ @abstract QLPreviewReplyAttachment is used to provide data for attachment in html data-based previews.
+ */
+API_AVAILABLE(ios(15.0), macos(12.0)) API_UNAVAILABLE(watchos,tvos)  __attribute__((visibility("default")))
+@interface QLPreviewReplyAttachment:NSObject
+
+/** The data content of an html preview*/
+@property (readonly) NSData* data;
+
+/** The content type of the attachment for an html preview*/
+@property (readonly) UTType* contentType;
+
+/**
+ @abstract Create an attachment for html previews by providing the data and mime type of the attachment.
+ @param data The data content of an html preview
+ @param contentType The UTType of the attachment for an html preview
+ */
+- (instancetype)initWithData:(NSData*)data contentType:(UTType*)contentType;
+
+@end
+
+/**
+ @abstract To provide a data-based preview, you have to return a QLPreviewReply object.
+ */
+API_AVAILABLE(ios(15.0), macos(12.0)) API_UNAVAILABLE(watchos,tvos)  __attribute__((visibility("default")))
+@interface QLPreviewReply : NSObject
+
+/** String encoding for text or html based previews. Defaults to NSUTF8StringEncoding. */
+@property NSStringEncoding stringEncoding;
+
+/** Attachments for HTML data previews. The keys of the dictionary are the attachment identifiers (eg foo) that can be referenced with the cid:id URL (eg cid:foo).*/
+@property (copy) NSDictionary<NSString*, QLPreviewReplyAttachment*>* attachments;
+
+/** Custom display title for the preview. If left as the empty string, QuickLook will use the file name.*/
+@property (copy) NSString* title;
+
+/**
+ @abstract
+ Use this method to provide a preview by drawing into a context.
+ 
+ @param contextSize The size of your image.
+ @param isBitmap Whether the context should be bitmap or vector.
+ @param drawingBlock The preview should be drawn into the context passed to this block. The QLPreviewReply passed into this block is the same as the one created by this method and is provided for convenience for any further updates to its properties during the drawing block. Return YES if the preview was successfully drawn into the context. Return NO and populate error otherwise.
+ */
+- (instancetype)initWithContextSize:(CGSize)contextSize isBitmap:(BOOL)isBitmap drawingBlock:(BOOL (^)(CGContextRef context, QLPreviewReply * reply, NSError** error))drawingBlock;
+
+
+/**
+ @abstract
+ Use this method to provide a preview by providing a URL to a file of a supported type.
+ 
+ @param fileURL  A file URL representing a preview of the previewed URL. Currently supported types include: UTTypeImage, UTTypePDF, UTTypeHTML, UTTypeXML, UTTypePlainText, UTTypeRTF, UTTypeRTFD, UTTypeMovie, UTTypeAudio
+ */
+- (instancetype)initWithFileURL:(NSURL *)fileURL;
+
+/**
+ @abstract
+ Use this method to provide a preview with data of a supported format.
+ 
+ @param contentType The content type of the data.
+ @param contentSize  A hint for the size you would like to display your content at. If your content has an intrinsic size built in, such as images and PDFs, that will be used as the final size, but providing the correct size here will allow QuickLook to present loading UI at the correct size before you are finished creating the data. QuickLook will use a default size if NSZeroSize is passed in.
+ @param dataCreationBlock Create and return data representing the file preview. Supported types include: UTTypeImage, UTTypePDF, UTTypeHTML, UTTypeXML, UTTypePlainText, UTTypeRTF. Heavy lifting should be done inside of the dataCreationBlock instead of when creating the QLPreviewReply. The QLPreviewReply passed into this block is the same as the one created by this method and is provided for convenience for any further updates to its properties, such as attachments, during the data generation. Return the data if successful. Populate error if unsuccessful.
+ */
+
+- (instancetype)initWithDataOfContentType:(UTType *)contentType contentSize:(CGSize)contentSize dataCreationBlock:(NSData * _Nullable (^)(QLPreviewReply * reply, NSError ** error))dataCreationBlock;
+
+@end
+
+NS_ASSUME_NONNULL_END
+#endif
+
+#import <PDFKit/PDFKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface QLPreviewReply (UI)
+
+/**
+ @abstract
+ Use this method to provide a preview with a PDFDocument
+ 
+ @param defaultPageSize The size of your pages in the document. If the page size varies, use the first page's size.
+ @param documentCreationBlock Create and return the PDFDocument. Heavy lifting should be done inside of the documentCreationBlock instead of when creating the QLPreviewReply. The QLPreviewReply passed into this block is the same as the one created by this method and is provided for convenience for any further updates to its properties during document creation. Return the PDFDocument if successfully created. Populate error if unsuccessful.
+ */
+- (instancetype)initForPDFWithPageSize:(CGSize)defaultPageSize documentCreationBlock:(PDFDocument * _Nullable (^)(QLPreviewReply * reply, NSError ** error))documentCreationBlock;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewSceneActivationConfiguration.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewSceneActivationConfiguration.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewSceneActivationConfiguration.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewSceneActivationConfiguration.h	2021-06-02 12:48:19.000000000 -0400
@@ -0,0 +1,38 @@
+//
+//  QLPreviewController.h
+//  Mobile Quick Look
+//
+//  Copyright 2021 Apple Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <UIKit/UIWindowSceneActivationConfiguration.h>
+
+#import <QuickLook/QLBase.h>
+
+
+NS_ASSUME_NONNULL_BEGIN
+
+API_AVAILABLE(ios(15.0)) QL_EXPORT
+@interface QLPreviewSceneOptions : NSObject
+    /*!
+     * @abstract The index of the item to preview initially .
+     */
+     @property (assign) NSInteger initialPreviewIndex;
+@end NS_SWIFT_NAME(QLPreviewSceneActivationConfiguration.Options)
+
+API_AVAILABLE(ios(15.0)) QL_EXPORT
+@interface QLPreviewSceneActivationConfiguration : UIWindowSceneActivationConfiguration
+
+    /**
+    * @abstract Create a new  scene configuration to preview items at `urls`.
+    * @param urls The urls of the items to preview.
+    * @param options Additional information to preview the items.
+    */
+- (instancetype)initWithItemsAtURLs:(NSArray <NSURL *> *)urls options:(nullable QLPreviewSceneOptions *)options NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)initWithUserActivity:(NSUserActivity *)userActivity NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewingController.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewingController.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewingController.h	2021-03-16 08:48:39.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QLPreviewingController.h	2021-06-02 12:48:19.000000000 -0400
@@ -11,12 +11,16 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class QLPreviewReply;
+@class QLFilePreviewRequest;
 /**
- The controller that implements the QLPreviewingController protocol must at least implement one of the two following methods:
+ For view based previews, the view controller that implements the QLPreviewingController protocol must at least implement one of the two following methods:
  -[QLPreviewingController preparePreviewOfSearchableItemWithIdentifier:queryString:completionHandler:], to generate previews for Spotlight searchable items.
  -[QLPreviewingController preparePreviewOfFileAtURL:completionHandler:], to generate previews for file URLs.
  
 The main preview should be presented by the view controller implementing QLPreviewingController. Avoid presenting additional view controllers over your QLPreviewingController. For Catalyst compatibility, avoid using gesture recognizers that take interactions over large portions of the view to avoid collisions with standard macOS preview behaviors.
+ 
+For data-based previews, subclass QLPreviewProvider which conforms to this protocol.
  */
 QL_EXPORT @protocol QLPreviewingController <NSObject>
 
@@ -51,6 +55,12 @@
  */
 - (void)preparePreviewOfFileAtURL:(NSURL *)url completionHandler:(void (^)(NSError * _Nullable))handler NS_SWIFT_NAME(preparePreviewOfFile(at:completionHandler:));
 
+/**
+ @abstract Use this method to provide a QLPreviewReply that provides preview in the form of NSData, NSURL, PDFDocument, or a drawing into a context.
+ @param request An object which contains information about the preview that should be provided. It contains the URL of the file to provide a preview for.
+ @param handler Call the completion handler with a QLPreviewReply if you can provide a preview, or with an NSError if you cannot. If an error is passed or reply is nil, a generic preview will be provided instead. The handler can be called asynchronously after the method has returned.
+ */
+- (void)providePreviewForFileRequest:(QLFilePreviewRequest*)request completionHandler:(void (^)(QLPreviewReply * _Nullable reply, NSError * _Nullable error))handler NS_SWIFT_NAME(providePreview(for:completionHandler:));
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QuickLook.apinotes /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QuickLook.apinotes
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QuickLook.apinotes	2021-03-16 03:42:34.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QuickLook.apinotes	2021-06-01 22:36:02.000000000 -0400
@@ -6,6 +6,22 @@
   - Selector: 'canPreviewItem:'
     SwiftName: canPreview(_:)
     MethodKind: Class
+- Name: QLPreviewReply
+  Methods:
+    - Selector: "initWithContextSize:isBitmap:drawingBlock:"
+      MethodKind: Instance
+      SwiftPrivate: true
+    - Selector: "initForPDFWithPageSize:documentCreationBlock:"
+      MethodKind: Instance
+      SwiftPrivate: true
+    - Selector: "initWithDataOfContentType:contentSize:dataCreationBlock:"
+      MethodKind: Instance
+      SwiftPrivate: true
+  Properties:
+    - Name: stringEncoding
+      PropertyKind: Instance
+      SwiftPrivate: true
+      
 SwiftVersions:
 #
 # Swift 4 and below specific conversions
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QuickLook.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QuickLook.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QuickLook.h	2021-03-16 08:41:32.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/QuickLook.framework/Headers/QuickLook.h	2021-06-01 22:45:08.000000000 -0400
@@ -19,6 +19,9 @@
 #import <QuickLook/QLThumbnailProvider.h>
 #import <QuickLook/QLThumbnailRequest.h>
 #import <QuickLook/QLThumbnailReply.h>
+#import <QuickLook/QLPreviewProvider.h>
+#import <QuickLook/QLPreviewReply.h>
+#import <QuickLook/QLFilePreviewRequest.h>
 #endif
 
 #endif
Clone this wiki locally