 
     func processAttachments() {
         guard let extensionItem = extensionContext?.inputItems.safeValue(0) as? NSExtensionItem else {
+            finishProcessing()
             return
         }
 

            ShareAttachmentProcessor.preview(extensionItem) { previews in
                inForeground {
                    self.itemPreviews = previews
                }
            }
        }
    }

    func showSpinner() {

class ShareViewController: SLComposeServiceViewController {

    var itemPreviews: [ExtensionItemPreview] = []
    var itemsProcessed = false
    fileprivate lazy var background: UIView = self.createBackground()

    fileprivate func createBackground() -> UIView {
        let view = UIView()
        view.alpha = 0
