sargturner
sargturner

Reputation: 560

QuickLook - canPreview w/o file downloaded

I'd like to know whether or not QuickLook supports a file before I download it so I can have a better UX flow. Anyone know if this is possible? It seems

QLPreviewController.canPreview(item: QLPreviewItem)

requires that the file be downloaded. Is there any better way than having a list of file extensions and checking my extension on that?

Upvotes: 1

Views: 556

Answers (1)

Andre
Andre

Reputation: 1145

Yes it does support opening without the file, but you can't check if the file is supported before it's downloaded.

If the file is not there, it will display an empty screen with a spinner, and display the file as soon as it's available.

I've just implemented this workflow on my app:

  • if the file is not downloaded, open Quicklook anyway
  • as soon as the file is downloaded, check with canPreview()
  • if the file is not supported, replace that item with a static image "format not recognised"

Hope this helps.

Upvotes: 1

Related Questions