                 guard self != nil else { return }
                 print("dataUTI: \(dataUTI ?? "")")
 
-                let imageElement = EFImage()
+                let imageElement: Ref<EFImage?> = nil
 
                 if kUTTypeGIF as String == dataUTI {
                     // MARK: GIF
-                    imageElement.isGIF = true
-
-                    if nil != imageData {
-                        imageElement.data = imageData
+                    if let imageData = imageData {
+                        imageElement.value = .gif(imageData)
                     }
                 } else {
                     // MARK: 其他格式的图片，直接请求压缩后的图片
-                    imageElement.isGIF = false
-
                     imageManager.requestImage(for: asset, targetSize: targetSize, contentMode: .aspectFill, options: options) {
                         [weak self] (result, info) in
                         guard self != nil,
+                            let result = result,
                             let isDegraded = info?[PHImageResultIsDegradedKey] as? Bool,
                             !isDegraded
                             else { return }
                         // 得到一张 UIImage，展示到界面上
-                        imageElement.data = result
+                        imageElement.value = .normal(result)
                     }
                 }
 

import EFQRCode
import MobileCoreServices

class EFImage {
    var isGIF: Bool = false
    var data: Any?

    init() {

    }

    init?(_ image: UIImage?) {
        if let image = image {
            self.data = image
            self.isGIF = false
        } else {
            return nil
        }
    }

    init?(_ data: Data?) {
        if let data = data {
            self.data = data
            self.isGIF = true
        } else {
            return nil
        }
    }
}


        generator.setBinarizationThreshold(binarizationThreshold: binarizationThreshold)
        generator.setPointShape(pointShape: pointShape)

        switch watermark {
        case .gif(let data)?: // GIF
            generator.setWatermark(watermark: nil, mode: watermarkMode)
            
            if let afterData = EFQRCode.generateWithGIF(data: data, generator: generator) {
                present(ShowController(image: .gif(afterData)), animated: true)
            } else {
                let alert = UIAlertController(title: "Warning", message: "Create QRCode failed!", preferredStyle: .alert)
                alert.addAction(UIAlertAction(title: "OK", style: .cancel))
                present(alert, animated: true)
            }
        case .normal(let image)?:
            generator.setWatermark(watermark: UIImage2CGimage(image), mode: watermarkMode)
            fallthrough // Other use UIImage
        default:
            if let tryCGImage = generator.generate() {
                let tryImage = UIImage(cgImage: tryCGImage)
                present(ShowController(image: .normal(tryImage)), animated: true)
            } else {
                let alert = UIAlertController(title: "Warning", message: "Create QRCode failed!", preferredStyle: .alert)
                alert.addAction(UIAlertAction(title: "OK", style: .cancel))
