Skip to content

Commit 941131e

Browse files
committed
documentation improvements
1 parent a76ca7c commit 941131e

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

Sources/GtkBackend/GtkBackend.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public final class GtkBackend: AppBackend {
7878
if ctx.interactiveDismissDisabled { return 1 }
7979

8080
if ctx.isProgrammaticDismiss {
81-
// Suppress onDismiss for programmatic closes
8281
ctx.isProgrammaticDismiss = false
8382
return 1
8483
}
@@ -98,9 +97,9 @@ public final class GtkBackend: AppBackend {
9897
guard let userData else { return 1 }
9998
let box = Unmanaged<ValueBox<() -> Void>>.fromOpaque(userData).takeUnretainedValue()
10099
box.value()
101-
return 1 // consume
100+
return 1
102101
}
103-
return 0 // let others handle
102+
return 0
104103
}
105104

106105
// A separate initializer to satisfy ``AppBackend``'s requirements.
@@ -1685,7 +1684,6 @@ public final class GtkBackend: AppBackend {
16851684
public func dismissSheet(_ sheet: Gtk.Window, window: ApplicationWindow?) {
16861685
let key: OpaquePointer = OpaquePointer(sheet.widgetPointer)
16871686
if let ctx = sheetContexts[key] {
1688-
// Suppress onDismiss when closing programmatically
16891687
ctx.isProgrammaticDismiss = true
16901688
}
16911689
sheet.destroy()

Sources/SwiftCrossUI/Views/Modifiers/PresentationModifiers.swift

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,47 @@ extension View {
2020
/// This modifier only affects the sheet presentation itself when applied to the
2121
/// top-level view within a sheet. It does not affect the content's corner radius.
2222
///
23-
/// supported platforms: iOS (ignored on unsupported platforms)
24-
/// ignored on: older than iOS 15
23+
/// supported platforms: iOS 15+, Gtk4 (ignored on unsupported platforms)
2524
///
2625
/// - Parameter radius: The corner radius in pixels.
2726
/// - Returns: A view with the presentation corner radius preference set.
2827
public func presentationCornerRadius(_ radius: Double) -> some View {
2928
preference(key: \.presentationCornerRadius, value: radius)
3029
}
31-
30+
31+
/// Sets the visibility of a sheet's drag indicator.
32+
///
33+
/// This modifier only affects the sheet presentation itself when applied to the
34+
/// top-level view within a sheet.
35+
///
36+
/// supported platforms: iOS 15+ (ignored on unsupported platforms)
37+
///
38+
/// - Parameter visibiliy: visible or hidden
39+
/// - Returns: A view with the presentation corner radius preference set.
3240
public func presentationDragIndicatorVisibility(
3341
_ visibility: PresentationDragIndicatorVisibility
3442
) -> some View {
3543
preference(key: \.presentationDragIndicatorVisibility, value: visibility)
3644
}
37-
45+
46+
/// Sets the background of a sheet.
47+
///
48+
/// This modifier only affects the sheet presentation itself when applied to the
49+
/// top-level view within a sheet.
50+
///
51+
/// - Parameter color: the background color
52+
/// - Returns: A view with the presentation corner radius preference set.
3853
public func presentationBackground(_ color: Color) -> some View {
3954
preference(key: \.presentationBackground, value: color)
4055
}
41-
56+
57+
/// Sets wether the user should be able to dismiss the sheet themself.
58+
///
59+
/// This modifier only affects the sheet presentation itself when applied to the
60+
/// top-level view within a sheet.
61+
///
62+
/// - Parameter isDisabled: is it disabled
63+
/// - Returns: A view with the presentation corner radius preference set.
4264
public func interactiveDismissDisabled(_ isDisabled: Bool = true) -> some View {
4365
preference(key: \.interactiveDismissDisabled, value: isDisabled)
4466
}

Sources/SwiftCrossUI/Views/Modifiers/SheetModifier.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
extension View {
2-
/// presents a conditional modal overlay
2+
/// Presents a conditional modal overlay
33
/// onDismiss optional handler gets executed before
44
/// dismissing the sheet
55
public func sheet<SheetContent: View>(

0 commit comments

Comments
 (0)