A swift image kit for iOS to display/decode WebP,APNG,GIF,PNG,JPG and more. Decode image on async thread and render when runloop idle.
Decode and display WEBP,APNG,GIF,PNG and so on
self.imageView = BerryAnimateImage(data, frame: CGRect(x: 0, y: 200, width: self.view.frame.size.width, height: 300), cache: BerryAnimateImage.Policy.noCache)
self.view.addSubview(self.imageView)
self.imageView.contentMode = .scaleAspectFit
self.imageView.animationRepeatCount = 0
self.imageView.startAnimating()
self.imageView.stopAnimating()
static public func getImageFormat(_ data: Data) -> BerryImageFormat
Find image decoder
public func FindImageDecoder(with data: Data) -> BerryImageProvider
To run the example project, clone the repo, and run pod install
from the Example directory first.
Berry is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Berry'
post_install do |installer|
FixBerryUmbrella()
end
def FixBerryUmbrella
berry_unbrella_file_path = (Dir::pwd + '/Pods/Headers/Public/BerryPlant/BerryPlant-umbrella.h')
File.open(berry_unbrella_file_path,"r:utf-8") do |lines|
buffer = lines.read
buffer = buffer.gsub("decode.h","WebP/decode.h")
buffer = buffer.gsub("encode.h","WebP/encode.h")
buffer = buffer.gsub("types.h","WebP/types.h")
File.open(berry_unbrella_file_path,"w"){|l|
l.write(buffer)
}
end
end
czqasn, [email protected]
Berry is available under the MIT license. See the LICENSE file for more info.