0.2.0
Migration Guide: 0.1 → 0.2
This document summarizes the changes from main and the steps to migrate from v0.1 to v0.2.
Breaking Changes
AnimatedImage(old protocol) →AnimatedImageSource(new protocol)APNGImage / GifImage / WebPImage→APNGImageSource / GifImageSource / WebPImageSourceAnimatedImageProviderConfiguration→AnimatedImage.Configuration(nested type)AnimatedImageProviderremoved (internal pipeline moved toAnimatedImage+AnimatedImageLoader)AnimatedImageView.configurationremoved (set configuration when creatingAnimatedImage)startAnimating()/stopAnimating()removed (animation auto-managed on add/remove)AnimatableCGImageView.willUpdateContents→updateContentsAnimatedImagePlayernow acceptsAnimatedImage(notany AnimatedImage)- SwiftUI
animatedImageProviderConfigurationenvironment key removed
Replacement Map
AnimatedImageProviderConfiguration→AnimatedImage.Configuration.environment(\.animatedImageProviderConfiguration, ...)→ removeAnimatedImageView.configuration = ...→ set onAnimatedImageinitAPNGImage(...)→APNGImageSource(...)+AnimatedImage(imageSource:withConfiguration:)startAnimating()/stopAnimating()→ removeAnimatedImage(old) →AnimatedImageSource
UIKit Migration Example
v0.1
let image = APNGImage(data: data)
let imageView = AnimatedImageView(frame: .zero)
imageView.image = image
imageView.startAnimating()v0.2
let imageSource = APNGImageSource(data: data)
let image = AnimatedImage(imageSource: imageSource, withConfiguration: .default)
let imageView = AnimatedImageView(frame: .zero)
imageView.image = image
// startAnimating/stopAnimating are no longer neededSwiftUI Migration Example
v0.1
let config: AnimatedImageProviderConfiguration = .default
AnimatedImagePlayer(image: GifImage(data: data))
.environment(\.animatedImageProviderConfiguration, config)v0.2
let image = AnimatedImage(gif: data, withConfiguration: .default)
AnimatedImagePlayer(image: image)Custom Implementation Migration
v0.1
public final class ManualAnimatedImage: AnimatedImage, @unchecked Sendable {
public let name: String
public let imageCount: Int
// implement size(at:), delayTime(at:), image(at:)
}v0.2
public final class ManualAnimatedImageSource: AnimatedImageSource, @unchecked Sendable {
public let name: String
public let imageCount: Int
// implement size(at:), delayTime(at:), image(at:)
}
let source = ManualAnimatedImageSource(...)
let image = AnimatedImage(imageSource: source, withConfiguration: .default)Notes
AnimatedImageProviderConfiguration.taskPriorityis removed.
UseAnimatedImageLoader.decode(_:layout:taskPriority:)if you need to control task priority.- If you subclass
AnimatableCGImageView, renamewillUpdateContentstoupdateContents.