mirror of
https://github.com/yattee/yattee.git
synced 2026-07-31 04:12:03 +00:00
Disable zoom navigation transitions when running on a Mac
Dismissing any SwiftUI sheet while a .navigationTransition(.zoom) is registered traps inside UIKit's _UIZoomTransitionController on the Mac presentation path (macOS 26.4.1, builds 259/261 crash reports). The same code path is stable on iOS and iPadOS, so this is an Apple framework bug on Mac that can only be avoided. Gate both zoom-transition modifiers on a cached runtime check for isMacCatalystApp / isiOSAppOnMac so the Mac build falls into the existing no-op branch while iOS and iPadOS keep the zoom animation.
This commit is contained in:
@@ -9,6 +9,14 @@
|
|||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
#if os(iOS)
|
||||||
|
/// Whether the iOS binary is running on a Mac (Catalyst or "Designed for iPad").
|
||||||
|
/// Zoom transitions trap inside UIKit's _UIZoomTransitionController when a sheet
|
||||||
|
/// is dismissed on the Mac presentation path, so they must stay off there.
|
||||||
|
private let zoomTransitionsRunningOnMac: Bool =
|
||||||
|
ProcessInfo.processInfo.isMacCatalystApp || ProcessInfo.processInfo.isiOSAppOnMac
|
||||||
|
#endif
|
||||||
|
|
||||||
// MARK: - Environment Keys
|
// MARK: - Environment Keys
|
||||||
|
|
||||||
/// Environment key to pass the navigation transition namespace through the view hierarchy.
|
/// Environment key to pass the navigation transition namespace through the view hierarchy.
|
||||||
@@ -49,7 +57,7 @@ struct ZoomTransitionSourceModifier<ID: Hashable>: ViewModifier {
|
|||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
if zoomTransitionsEnabled, let namespace {
|
if zoomTransitionsEnabled, !zoomTransitionsRunningOnMac, let namespace {
|
||||||
content
|
content
|
||||||
.matchedTransitionSource(id: id, in: namespace)
|
.matchedTransitionSource(id: id, in: namespace)
|
||||||
} else {
|
} else {
|
||||||
@@ -75,7 +83,7 @@ struct ZoomTransitionDestinationModifier<ID: Hashable>: ViewModifier {
|
|||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
if zoomTransitionsEnabled, let namespace {
|
if zoomTransitionsEnabled, !zoomTransitionsRunningOnMac, let namespace {
|
||||||
content
|
content
|
||||||
.navigationTransition(.zoom(sourceID: id, in: namespace))
|
.navigationTransition(.zoom(sourceID: id, in: namespace))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user