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