Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
macOS Quick Look Preview Extension not calling -viewDidDisappear

I'm implementing a Quick Look Preview extension on macOS that will preview some unsupported audio types.

To be able to stop the audio playback when the user stops previewing, I'm pausing my audio engine in -viewDidDisappear.

However, the problem is that -viewDidDisappear is only called when exiting out of Quick Look in Finder altogether, not when I'm navigating to the next/previous file with the arrow keys.

class PreviewViewController: NSViewController, QLPreviewingController {
    func preparePreviewOfFile(at url: URL, completionHandler handler: @escaping (Error?) -> Void) {
        player.load(url)
        player.play()
    }
    
    override func viewDidDisappear() {
        // Not called when switching to the next or previous preview in Finder!
        player.stop()
    }
}

I've tried going through all the usual suspects on both NSViewController (-removeFromParent, -viewWillDisappear, -viewDidDisappear) and it's NSView (-viewDidHide, -viewDidMoveToWindow, -viewDidMoveToSuperview), but without success.

Neither of them are called when I switch to a different file in the Quick Look preview in Finder with the arrow keys (resulting in the audio just continuing to play while I'm Quick Looking some other file).

Anyone knows how to know if my preview view controller has been hidden?

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda