Skip to content

Commit f8b1b81

Browse files
authored
Fix existential any (#199)
1 parent 208313b commit f8b1b81

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/Gifu/Classes/Animator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class Animator {
2020
private var displayLinkInitialized: Bool = false
2121

2222
/// A delegate responsible for displaying the GIF frames.
23-
private weak var delegate: GIFAnimatable!
23+
private weak var delegate: (any GIFAnimatable)!
2424

2525
/// Callback for when all the loops of the animation are done (never called for infinite loops)
2626
private var animationBlock: (() -> Void)? = nil
@@ -55,7 +55,7 @@ public class Animator {
5555
/// - parameter view: A view object that implements the `GIFAnimatable` protocol.
5656
///
5757
/// - returns: A new animator instance.
58-
public init(withDelegate delegate: GIFAnimatable) {
58+
public init(withDelegate delegate: any GIFAnimatable) {
5959
self.delegate = delegate
6060
}
6161

Sources/Gifu/Classes/GIFAnimatable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ extension GIFAnimatable {
133133
public func prepareForAnimation(withGIFData imageData: Data,
134134
loopCount: Int = 0,
135135
completionHandler: (() -> Void)? = nil) {
136-
if var imageContainer = self as? ImageContainer {
136+
if var imageContainer = self as? any ImageContainer {
137137
imageContainer.image = UIImage(data: imageData)
138138
}
139139

@@ -209,7 +209,7 @@ extension GIFAnimatable {
209209

210210
/// Updates the image with a new frame if necessary.
211211
public func updateImageIfNeeded() {
212-
if var imageContainer = self as? ImageContainer {
212+
if var imageContainer = self as? any ImageContainer {
213213
let container = imageContainer
214214
imageContainer.image = activeFrame ?? container.image
215215
} else {

0 commit comments

Comments
 (0)