func showActionSheet()

in iOS/WAStickersThirdParty/StickerPackViewController.swift [228:255]


    func showActionSheet(withSticker sticker: Sticker, overCell cell: UICollectionViewCell) {
        var emojisString: String?

        #if DEBUG
        if let emojis = sticker.emojis {
            emojisString = emojis.joined(separator: " ")
        }
        #endif

        let actionSheet: UIAlertController = UIAlertController(title: "\n\n\n\n\n\n\n", message: emojisString, preferredStyle: .actionSheet)
        
        actionSheet.popoverPresentationController?.sourceView = cell.contentView
        actionSheet.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection()
        actionSheet.popoverPresentationController?.sourceRect = CGRect(x: cell.contentView.bounds.midX, y: cell.contentView.bounds.midY, width: 0, height: 0)

        actionSheet.addAction(UIAlertAction(title: "Copy to Clipboard", style: .default, handler: { _ in
            sticker.copyToPasteboardAsImage()
        }))
        actionSheet.addAction(UIAlertAction(title: "Share via", style: .default, handler: { _ in
            self.showShareSheet(withSticker: sticker)
        }))
        actionSheet.addAction(UIAlertAction(title: "Cancel", style: .cancel))

        if let stickerImage = sticker.imageData.image {
            actionSheet.addImageView(withImage: stickerImage, animated: sticker.imageData.animated)
        }
        present(actionSheet, animated: true)
    }