         return image.resizableImage(withCapInsets: capInsets, resizingMode: .stretch)
     }
 
+    private static let bubbleImageCache = NSCache<NSString, UIImage>()
 }


        guard let path = imagePath else { return nil }

        guard var image = UIImage(contentsOfFile: path) else { return nil }

        switch self {

            image = UIImage(cgImage: cgImage, scale: image.scale, orientation: corner.imageOrientation)
        }

        let stretchedImage = stretch(image)
        cache.setObject(stretchedImage, forKey: path as NSString)
        return stretchedImage
    }

    // MARK: - Private
