From 472f6aad237134daf4fd4ff6f37b2744e1140896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=CC=8Cimon=20S=CC=8Cesta=CC=81k?= Date: Mon, 12 Aug 2024 09:29:49 +0200 Subject: [PATCH] Fix macOS --- Sources/FuturedArchitecture/Architecture/Coordinator.swift | 2 ++ .../Architecture/NavigationStackFlow.swift | 4 +++- Sources/FuturedArchitecture/Architecture/TabViewFlow.swift | 4 +++- Sources/FuturedHelpers/Helpers/SceneDelegate.swift | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Sources/FuturedArchitecture/Architecture/Coordinator.swift b/Sources/FuturedArchitecture/Architecture/Coordinator.swift index 198b69c..fa581b5 100644 --- a/Sources/FuturedArchitecture/Architecture/Coordinator.swift +++ b/Sources/FuturedArchitecture/Architecture/Coordinator.swift @@ -25,10 +25,12 @@ public extension Coordinator { Task { @MainActor in self.modalCover = .init(destination: destination, style: .sheet) } + #if !os(macOS) case .fullscreenCover: Task { @MainActor in self.modalCover = .init(destination: destination, style: .fullscreenCover) } + #endif } } diff --git a/Sources/FuturedArchitecture/Architecture/NavigationStackFlow.swift b/Sources/FuturedArchitecture/Architecture/NavigationStackFlow.swift index 06380ea..6ebc267 100644 --- a/Sources/FuturedArchitecture/Architecture/NavigationStackFlow.swift +++ b/Sources/FuturedArchitecture/Architecture/NavigationStackFlow.swift @@ -14,7 +14,7 @@ public struct NavigationStackFlow { .init { coordinator.modalCover?.style == .fullscreenCover ? coordinator.modalCover?.destination : nil @@ -41,4 +42,5 @@ public struct NavigationStackFlow: View { TabView(selection: $coordinator.selectedTab) { content() } - .sheet(item: $coordinator.sheet, onDismiss: coordinator.onSheetDismiss, content: coordinator.scene(for:)) + .sheet(item: sheetBinding, onDismiss: coordinator.onModalDismiss, content: coordinator.scene(for:)) } #else public var body: some View { @@ -34,6 +34,7 @@ public struct TabViewFlow: View { } } + #if !os(macOS) private var fullscreenCoverBinding: Binding { .init { coordinator.modalCover?.style == .fullscreenCover ? coordinator.modalCover?.destination : nil @@ -41,4 +42,5 @@ public struct TabViewFlow: View { coordinator.modalCover = destination.map { .init(destination: $0, style: .fullscreenCover) } } } + #endif } diff --git a/Sources/FuturedHelpers/Helpers/SceneDelegate.swift b/Sources/FuturedHelpers/Helpers/SceneDelegate.swift index 24effcc..8a6d0f3 100644 --- a/Sources/FuturedHelpers/Helpers/SceneDelegate.swift +++ b/Sources/FuturedHelpers/Helpers/SceneDelegate.swift @@ -7,6 +7,7 @@ import SwiftUI +#if !os(macOS) protocol AppSceneDelegate: AnyObject, UIWindowSceneDelegate, ObservableObject { var delegate: SceneDelegate? { get set } } @@ -40,3 +41,4 @@ extension View { modifier(SceneDelegateWrapperViewModifier(delegate: sceneDelegate)) } } +#endif