Skip to content

Commit

Permalink
Updates to full screen sheet presentation on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdifran committed Jan 17, 2024
1 parent 64e53c3 commit fb848e2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/AppUI/Extensions/View/View+Sheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ import SwiftUI

public extension View {

/// Presents the view as a sheet.
func sheet(_ view: Binding<AnyView?>) -> some View {
sheet(isPresented: Binding(isNotNil: view, defaultValue: nil)) {
view.wrappedValue
}
}

#if os(iOS)
/// Presents the view as a full screen cover. On macOS, the view is presented as a sheet.
func fullScreenCover(_ view: Binding<AnyView?>) -> some View {
#if os(macOS)
sheet(view)
#else
fullScreenCover(isPresented: Binding(isNotNil: view, defaultValue: nil)) {
view.wrappedValue
}
#endif
}
#endif
}

0 comments on commit fb848e2

Please sign in to comment.