Fix compiling for Catalyst

This commit is contained in:
Shadowfacts 2022-07-02 11:33:15 -07:00
parent 5cb25c8c1f
commit efb96eddf3
1 changed files with 6 additions and 0 deletions

View File

@ -19,8 +19,10 @@ protocol LargeImageContentView: UIView {
class LargeImageImageContentView: UIImageView, LargeImageContentView {
#if !targetEnvironment(macCatalyst)
@available(iOS 16.0, *)
private static let analyzer = ImageAnalyzer()
#endif
var animationImage: UIImage? { image! }
@ -39,6 +41,7 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView {
contentMode = .scaleAspectFit
isUserInteractionEnabled = true
#if !targetEnvironment(macCatalyst)
if #available(iOS 16.0, *),
ImageAnalyzer.isSupported {
let interaction = ImageAnalysisInteraction()
@ -54,6 +57,7 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView {
}
}
}
#endif
}
required init?(coder: NSCoder) {
@ -78,12 +82,14 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView {
}
}
#if !targetEnvironment(macCatalyst)
@available(iOS 16.0, *)
extension LargeImageImageContentView: ImageAnalysisInteractionDelegate {
func presentingViewController(for interaction: ImageAnalysisInteraction) -> UIViewController? {
return owner
}
}
#endif
class LargeImageGifContentView: GIFImageView, LargeImageContentView {
var animationImage: UIImage? { image }