Optimize performance with Integrity and Memory limits
masterSwiftyGif provides parameters to balance CPU usage and memory consumption via SwiftyGifManager.
Integrity Level
Lowering the levelOfIntegrity causes the player to skip frames, which reduces both CPU and memory usage. This is useful for displaying many GIF previews simultaneously.
do {
let gif = try UIImage(gifName: "MyImage.gif", levelOfIntegrity: 0.5)
} catch {
print(error)
}Memory Limit
You can adjust the memoryLimit to control CPU/Memory usage. Note that there is a tradeoff: limiting memory usage typically increases CPU usage.
By default, the library uses SwiftyGifManager.defaultManager to manage memory pools across multiple UIImageView instances.