Determine Starting location for QuickLook Extension

I am writing a QuickLook extension using Swift (specifically QLPreviewingController).

Extensions can be opened from both the previewer (pressing Space with a file selected) and Get Info. How do I reliably detect which mode my extension is being started from?

The problem is that when it's in the Get Info window, it forces a fixed width (but not height). If I set the size statically based on that width, then when it launches in its own window (via Space), you can't resize the preview window.

What am I missing? It seems like I should be getting more context about where I'm being inserted so I can lay out accordingly?

Does anyone have any suggestions or have faced this problem before?

Determine Starting location for QuickLook Extension
 
 
Q