Skip to content

Commit

Permalink
Fix compile issue in ConfrimationDialogModifier
Browse files Browse the repository at this point in the history
  • Loading branch information
MalekKamel committed Apr 4, 2023
1 parent 8bd8601 commit 10331bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion SwiftUINavigator/Sources/SwiftUINavigator/NavView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct NavViewContent<Root>: View where Root: View {
isPresented: $manager.confirmationDialogManager.isPresented,
titleVisibility: manager.confirmationDialogManager.titleVisibility,
actions: {
manager.confirmationDialogManager.content?.eraseToAnyView()
manager.confirmationDialogManager.content?.eraseToAnyView() ?? EmptyView().eraseToAnyView()
}
))
#if os(iOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ struct ConfirmationDialogModifier: ViewModifier {
private let titleKey: LocalizedStringKey
@Binding private var isPresented: Bool
private let titleVisibility: ConfirmationDialogVisibility
private let actions: () -> AnyView?
private let actions: () -> AnyView

init(_ titleKey: LocalizedStringKey,
isPresented: Binding<Bool>,
titleVisibility: ConfirmationDialogVisibility = .automatic,
actions: @escaping () -> AnyView?) {
actions: @escaping () -> AnyView) {
self.titleKey = titleKey
_isPresented = isPresented
self.titleVisibility = titleVisibility
Expand All @@ -56,7 +56,7 @@ struct ConfirmationDialogModifier: ViewModifier {

func body(content: Content) -> some View {
Group {
if #available(iOS 15.0, macOS 12.0, *), let actions {
if #available(iOS 15.0, macOS 12.0, *) {
content
.confirmationDialog(
titleKey,
Expand Down

0 comments on commit 10331bd

Please sign in to comment.