Search code examples
iosquicklook

Can I check if QuickLook support/opens given file?


I am using Quick Look Framework for attachments preview and would need to mark unsupported files before launching the QLPreviewController. Can I programatically somehow check if QuickLook will actually preview the file and how?


Solution

  • You can use canPreviewItem property from QLPreviewController to check whether the item can be previewed by QLPreviewController

    Btw these are the files supported by QLPreviewController(Ref)

    iWork documents

    Microsoft Office documents (Office ‘97 and newer)

    Rich Text Format (RTF) documents

    PDF files

    Images

    Text files whose uniform type identifier (UTI) conforms to the public.text type (see Uniform Type Identifiers Reference)

    Comma-separated value (csv) files