Skip to content

Commit b00fa91

Browse files
committed
Update AnimatableCGImageView.swift
1 parent 478ce9a commit b00fa91

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/AnimatedImage/BaseClass/AnimatableCGImageView.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ public import UIKit
22
import UpdateLink
33

44
open class AnimatableCGImageView: CGImageView {
5-
var updateLink: (any UpdateLink)!
5+
lazy var updateLink: (any UpdateLink) = { preconditionFailure() }()
66

77
public override init(frame: CGRect) {
88
super.init(frame: frame)
99
if #available(iOS 18.0, visionOS 2.0, *) {
10-
updateLink = UIUpdateLink(view: self)
10+
// workaround: Designed for iPad doesn't have UIUpdateLink.
11+
if ProcessInfo.processInfo.isiOSAppOnMac {
12+
updateLink = BackportUpdateLink(view: self)
13+
} else {
14+
updateLink = UIUpdateLink(view: self)
15+
}
1116
} else {
1217
updateLink = BackportUpdateLink(view: self)
1318
}

0 commit comments

Comments
 (0)