Skip to content

Commit 6aedc32

Browse files
committed
add docs for new modifiers
1 parent 8d76fe9 commit 6aedc32

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

JDStatusBarNotification/Public/NotificationViewExtension.swift

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ private struct SwiftUINotficationState {
1616
extension View {
1717
public typealias NotificationPrepareStyleClosure = (StatusBarNotificationStyle) -> Void
1818

19+
/// Presents a notification when a given condition is true.
20+
///
21+
/// - Parameters:
22+
/// - isPresented: A binding to a Boolean value that determines whether to
23+
/// present the notification. When the notification gets dismissed for any reason,
24+
/// this value will be set to `false` again.
25+
/// - style: A ``NotificationPrepareStyleClosure`` to customize a ``StatusBarNotificationStyle`` freely.
26+
/// - viewBuilder: A ViewBuilder closure to build your custom SwiftUI view.
27+
///
28+
/// The `View` created by the `viewBuilder` will be layouted according to the selected style & the current device
29+
/// state (rotation, status bar visibility, etc.). The background will be styled & layouted
30+
/// according to the provided style. If your custom view requires custom touch handling,
31+
/// make sure to set `style.canTapToHold` to `false`. Otherwise the `customView` won't receive any touches.
32+
///
1933
nonisolated public func notification(isPresented: Binding<Bool>, style: NotificationPrepareStyleClosure? = nil, @ViewBuilder viewBuilder: () -> some View) -> some View {
2034
let np = NotificationPresenter.shared
2135
var styleName: String? = nil
@@ -28,6 +42,21 @@ extension View {
2842
return notification(isPresented: isPresented, styleName: styleName, viewBuilder: viewBuilder)
2943
}
3044

45+
46+
/// Presents a notification when a given condition is true.
47+
///
48+
/// - Parameters:
49+
/// - isPresented: A binding to a Boolean value that determines whether to
50+
/// present the notification. When the notification gets dismissed for any reason,
51+
/// this value will be set to `false` again.
52+
/// - includedStyle: A predefined ``IncludedStatusBarNotificationStyle`` to style this notification.
53+
/// - viewBuilder: A ViewBuilder closure to build your custom SwiftUI view.
54+
///
55+
/// The `View` created by the `viewBuilder` will be layouted according to the selected style & the current device
56+
/// state (rotation, status bar visibility, etc.). The background will be styled & layouted
57+
/// according to the provided style. If your custom view requires custom touch handling,
58+
/// make sure to set `style.canTapToHold` to `false`. Otherwise the `customView` won't receive any touches.
59+
///
3160
nonisolated public func notification(isPresented: Binding<Bool>, includedStyle: IncludedStatusBarNotificationStyle? = nil, @ViewBuilder viewBuilder: () -> some View) -> some View {
3261
let np = NotificationPresenter.shared
3362
var styleName: String? = nil
@@ -37,6 +66,22 @@ extension View {
3766
return notification(isPresented: isPresented, styleName: styleName, viewBuilder: viewBuilder)
3867
}
3968

69+
70+
/// Presents a notification when a given condition is true.
71+
///
72+
/// - Parameters:
73+
/// - isPresented: A binding to a Boolean value that determines whether to
74+
/// present the notification. When the notification gets dismissed for any reason,
75+
/// this value will be set to `false` again.
76+
/// - styleName: The name of the style. You can use styles previously added using e.g. ``addStyle(named:usingStyle:prepare:)``.
77+
/// If no style can be found for the given `styleName` or it is `nil`, the default style will be used.
78+
/// - viewBuilder: A ViewBuilder closure to build your custom SwiftUI view.
79+
///
80+
/// The `View` created by the `viewBuilder` will be layouted according to the selected style & the current device
81+
/// state (rotation, status bar visibility, etc.). The background will be styled & layouted
82+
/// according to the provided style. If your custom view requires custom touch handling,
83+
/// make sure to set `style.canTapToHold` to `false`. Otherwise the `customView` won't receive any touches.
84+
///
4085
nonisolated public func notification(isPresented: Binding<Bool>, styleName: String? = nil, @ViewBuilder viewBuilder: () -> some View) -> some View {
4186
let np = NotificationPresenter.shared
4287

0 commit comments

Comments
 (0)