Code Monkey home page Code Monkey logo

sdwebimagelottiecoder's Issues

Does it support caching?

I implemented a small caching mechanism. My code loads json and displays Lottie animations on a collection view. But when I am going back (up) it crashes.

`private let cacheKey = "StickerCache"

func cache(image: UIImage?, for urlString: String) {
    let path = NSTemporaryDirectory().appending(UUID().uuidString)
    let url = URL(fileURLWithPath: path)
    
    if let imageData = image?.sd_imageData() {
        try? imageData.write(to: url)
        var dict = UserDefaults.standard.object(forKey: cacheKey) as? [String: String] ?? [String: String]()
        dict[urlString] = path
        UserDefaults.standard.setValue(dict, forKey: cacheKey)
    }
}

func loadCache(urlString: String) -> UIImage? {
    if let dict = UserDefaults.standard.object(forKey: cacheKey) as? [String: String] {
        if let path = dict[urlString] {
            if let data = try? Data(contentsOf: URL(fileURLWithPath: path)) {
                let scale = UIScreen.main.scale
                let option = [SDImageCoderOption.decodeThumbnailPixelSize: CGSize(width: 80 * scale,
                                                                                  height: 80 * scale)]
                // Crashes here
                return SDImageLottieCoder.shared.decodedImage(with: data, options: option)
            }
        }
    }
    
    return nil
}

`
It does not output anything to the console, but I guess it has something to do with json decoding. maybe you can steer me into the right direction.
image

Could not build module 'librlottie'

Hey, first of all thank you so much for this lib. It's exactly what I was looking for.
Unfortunately I can not build on a simple Test project.

Screenshot 2021-02-23 at 01 51 49

Screenshot 2021-02-23 at 01 52 23

I got that same issue with SDWebImageLottieCoder 0.2.1

Not sure what I am doing wrong. Just installed the SPM and tried to build

Thanks

not building

I can't build an example or clear project with installed pod:
'rlottiecommon.h' file not found with <angled> include; use "quotes" instead

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.