From 9ea0178589d33c6719c42c3d5e74065a715fd52d Mon Sep 17 00:00:00 2001 From: Shaban Date: Tue, 22 Nov 2022 15:20:19 +0200 Subject: [PATCH] Fix dimissing sheet --- Demo/Screens/Home/HomeScreen.swift | 1 - .../Sources/SwiftUINavigator/Sheet/SheetManager.swift | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Demo/Screens/Home/HomeScreen.swift b/Demo/Screens/Home/HomeScreen.swift index b7dda98..a39d60f 100644 --- a/Demo/Screens/Home/HomeScreen.swift +++ b/Demo/Screens/Home/HomeScreen.swift @@ -75,7 +75,6 @@ struct HomeScreen: View { dismissButton: .cancel()) } } - } private func presentDialog() { navigator.presentDialog(dismissOnTouchOutside: true) { diff --git a/SwiftUINavigator/Sources/SwiftUINavigator/Sheet/SheetManager.swift b/SwiftUINavigator/Sources/SwiftUINavigator/Sheet/SheetManager.swift index 4b98056..130baa6 100644 --- a/SwiftUINavigator/Sources/SwiftUINavigator/Sheet/SheetManager.swift +++ b/SwiftUINavigator/Sources/SwiftUINavigator/Sheet/SheetManager.swift @@ -37,7 +37,7 @@ class SheetManager: ObservableObject { height: 0, isDismissable: false) #if os(iOS) - private var fixedSheetPresenter: UIViewController? = nil + private var fixedSheetPresenter: FixedSheetPresenter = .rootController #endif } @@ -108,7 +108,7 @@ extension SheetManager { #if os(iOS) case let .fixedHeight(type, isDismissable, presenter): - fixedSheetPresenter = presenter.controller + fixedSheetPresenter = presenter presentFixedSheet( height: type.height, isDismissable: isDismissable, @@ -165,8 +165,8 @@ extension SheetManager { private func dismissFixedSheet() { #if os(iOS) - fixedSheetPresenter?.dismiss(animated: false) - fixedSheetPresenter = nil + fixedSheetPresenter.controller?.dismiss(animated: false) + fixedSheetPresenter = .rootController #endif } } \ No newline at end of file