pub unsafe trait QLPreviewingController: NSObjectProtocol {
// Provided methods
unsafe fn preparePreviewOfSearchableItemWithIdentifier_queryString_completionHandler(
&self,
identifier: &NSString,
query_string: Option<&NSString>,
handler: &DynBlock<dyn Fn(*mut NSError)>,
)
where Self: Sized + Message { ... }
unsafe fn preparePreviewOfFileAtURL_completionHandler(
&self,
url: &NSURL,
handler: &DynBlock<dyn Fn(*mut NSError)>,
)
where Self: Sized + Message { ... }
unsafe fn providePreviewForFileRequest_completionHandler(
&self,
request: &QLFilePreviewRequest,
handler: &DynBlock<dyn Fn(*mut QLPreviewReply, *mut NSError)>,
)
where Self: Sized + Message { ... }
}QLPreviewingController only.Expand description
A protocol for implementing a custom controller to create previews of files.
A controller that implements the <doc ://com.apple.documentation/documentation/quicklook/qlpreviewingcontroller> protocol must at least implement <doc ://com.apple.documentation/documentation//quicklook/qlpreviewingcontroller/2882042-preparepreviewofsearchableitem> or <doc ://com.apple.documentation/documentation/quicklook/qlpreviewingcontroller/2867936-preparepreviewoffile>.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn preparePreviewOfSearchableItemWithIdentifier_queryString_completionHandler(
&self,
identifier: &NSString,
query_string: Option<&NSString>,
handler: &DynBlock<dyn Fn(*mut NSError)>,
)
Available on crate feature block2 only.
unsafe fn preparePreviewOfSearchableItemWithIdentifier_queryString_completionHandler( &self, identifier: &NSString, query_string: Option<&NSString>, handler: &DynBlock<dyn Fn(*mut NSError)>, )
block2 only.Prepares the preview for a file by using the data from Spotlight’s searchable item.
The operating system calls this method only once from the main thread before it presents the previewing controller. To avoid blocking the main thread, don’t perform long-running or resource-intensive work.
- Parameters:
- identifier: The identifier of the searchable item.
- queryString: A search string to associate with the searchable item.
- handler: A completion handler that notifies the platform that a preview is available. The operating system shows a loading spinner, so call the handler as soon as possible. You can call the completion handler asynchronously after returning from the callback.
Sourceunsafe fn preparePreviewOfFileAtURL_completionHandler(
&self,
url: &NSURL,
handler: &DynBlock<dyn Fn(*mut NSError)>,
)
Available on crate feature block2 only.
unsafe fn preparePreviewOfFileAtURL_completionHandler( &self, url: &NSURL, handler: &DynBlock<dyn Fn(*mut NSError)>, )
block2 only.Prepares the preview of a file at the specified file’s URL.
The operating system calls this method only once from the main thread before it presents the previewing controller. To avoid blocking the main thread, don’t perform long-running or resource-intensive work.
When preparing and displaying the view controller, avoid holding open a file descriptors while the user is previewing the file.
- Parameters:
- url: The URL of the file to preview.
- handler: A completion handler that notifies the platform that a preview is available. The operating system shows a loading spinner, so call the handler as soon as possible. You can call the completion handler asynchronously after returning from the callback.
Sourceunsafe fn providePreviewForFileRequest_completionHandler(
&self,
request: &QLFilePreviewRequest,
handler: &DynBlock<dyn Fn(*mut QLPreviewReply, *mut NSError)>,
)
Available on crate features QLFilePreviewRequest and QLPreviewReply and block2 only.
unsafe fn providePreviewForFileRequest_completionHandler( &self, request: &QLFilePreviewRequest, handler: &DynBlock<dyn Fn(*mut QLPreviewReply, *mut NSError)>, )
QLFilePreviewRequest and QLPreviewReply and block2 only.Prepares the preview of a file identified within a file preview request.
- Parameters:
- request: The file preview request that identifies the content to preview.
- handler: The closure to call with a <doc ://com.apple.documentation/documentation/quicklook/qlpreviewreply> for the system to display as the preview.