QLPreviewingController

Trait QLPreviewingController 

Source
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 { ... }
}
Available on crate feature 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§

Source

unsafe fn preparePreviewOfSearchableItemWithIdentifier_queryString_completionHandler( &self, identifier: &NSString, query_string: Option<&NSString>, handler: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate feature 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.
Source

unsafe fn preparePreviewOfFileAtURL_completionHandler( &self, url: &NSURL, handler: &DynBlock<dyn Fn(*mut NSError)>, )
where Self: Sized + Message,

Available on crate feature 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.
Source

unsafe fn providePreviewForFileRequest_completionHandler( &self, request: &QLFilePreviewRequest, handler: &DynBlock<dyn Fn(*mut QLPreviewReply, *mut NSError)>, )
where Self: Sized + Message,

Available on crate features 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.

Trait Implementations§

Source§

impl ProtocolType for dyn QLPreviewingController

Source§

const NAME: &'static str = "QLPreviewingController"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn QLPreviewingController

Implementations on Foreign Types§

Source§

impl<T> QLPreviewingController for ProtocolObject<T>

Implementors§