TIL a bit about Quick Look
Watched Quick Look Previews from the Ground Up. It’s about iOS. But actually, same approach should work for macOS as well. QuickLook works on both, iOS and macOS. Previews or Thumbnail Images for macOS 10.14 or Earlier.
What’s New in File Management and Quick Look.
Here’s correct way of creating temporary file for atomic document creation which will speed up following moving file to final location or deletion in multivolume environment:
do {
let tempURL = try FileManager.default.url(for: .itemReplacementDirectory, in: [.userDomainMask], appropriateFor: url, create: true)
} catch { // Handle error }