diff --git a/Tusker/Extensions/UIViewController+Delegates.swift b/Tusker/Extensions/UIViewController+Delegates.swift index 0bfa53e5..03e8e24a 100644 --- a/Tusker/Extensions/UIViewController+Delegates.swift +++ b/Tusker/Extensions/UIViewController+Delegates.swift @@ -6,6 +6,7 @@ // Copyright © 2018 Shadowfacts. All rights reserved. // +#if !os(visionOS) import UIKit extension UIViewController: UIViewControllerTransitioningDelegate { @@ -34,3 +35,4 @@ extension UIViewController: UIViewControllerTransitioningDelegate { return nil } } +#endif diff --git a/Tusker/Screens/Utilities/CustomAlertController.swift b/Tusker/Screens/Utilities/CustomAlertController.swift index 58bd2429..1eae7bef 100644 --- a/Tusker/Screens/Utilities/CustomAlertController.swift +++ b/Tusker/Screens/Utilities/CustomAlertController.swift @@ -470,6 +470,17 @@ class CustomAlertActionButton: UIControl { } } +#if os(visionOS) +extension CustomAlertController: UIViewControllerTransitioningDelegate { + func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { + return CustomAlertPresentationAnimation() + } + + func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { + return CustomAlertDismissAnimation() + } +} +#else extension CustomAlertController { override func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { return CustomAlertPresentationAnimation() @@ -479,6 +490,7 @@ extension CustomAlertController { return CustomAlertDismissAnimation() } } +#endif class CustomAlertPresentationAnimation: NSObject, UIViewControllerAnimatedTransitioning { func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { diff --git a/Tusker/TuskerNavigationDelegate.swift b/Tusker/TuskerNavigationDelegate.swift index eb3be9c0..5de7f567 100644 --- a/Tusker/TuskerNavigationDelegate.swift +++ b/Tusker/TuskerNavigationDelegate.swift @@ -129,13 +129,17 @@ extension TuskerNavigationDelegate { func showLoadingLargeImage(url: URL, cache: ImageCache, description: String?, animatingFrom sourceView: UIImageView) { let vc = LoadingLargeImageViewController(url: url, cache: cache, imageDescription: description) vc.animationSourceView = sourceView + #if !os(visionOS) vc.transitioningDelegate = self + #endif present(vc, animated: true) } func gallery(attachments: [Attachment], sourceViews: [UIImageView?], startIndex: Int) -> GalleryViewController { let vc = GalleryViewController(attachments: attachments, sourceViews: sourceViews, startIndex: startIndex) + #if !os(visionOS) vc.transitioningDelegate = self + #endif return vc }