Skip to content

Commit 3608620

Browse files
committed
Some environment modifier documentation.
1 parent e5edd03 commit 3608620

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Sources/DiffableTextViewsXUIKit/DiffableTextField.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,19 @@ public extension View {
290290
// MARK: Setup
291291
//=------------------------------------------------------------------------=
292292

293+
/// Adds an action to perform when this view is set up.
294+
///
295+
/// DiffableTextField will trigger this action once throughout its life cycle.
296+
///
293297
@inlinable func onSetup(of view: DiffableTextFieldID,
294298
_ action: @escaping (ProxyTextField) -> Void) -> some View {
295299
environment(\.diffableTextField_onSetup, Trigger(action))
296300
}
297301

302+
/// Prevents this view from invoking actions from above this view in the view hierarchy.
303+
///
304+
/// It is similar to SwiftUI.View/submitScope(\_:).
305+
///
298306
@inlinable func onSetupScope(of view: DiffableTextFieldID) -> some View {
299307
environment(\.diffableTextField_onSetup, nil)
300308
}
@@ -303,11 +311,19 @@ public extension View {
303311
// MARK: Update
304312
//=------------------------------------------------------------------------=
305313

314+
/// Adds an action to perform when this view is updated.
315+
///
316+
/// DiffableTextField may trigger this action multiple times throughout its life cycle.
317+
///
306318
@inlinable func onUpdate(of view: DiffableTextFieldID,
307319
_ action: @escaping (ProxyTextField) -> Void) -> some View {
308320
environment(\.diffableTextField_onUpdate, Trigger(action))
309321
}
310322

323+
/// Prevents this view from invoking actions from above this view in the view hierarchy.
324+
///
325+
/// It is similar to SwiftUI.View/submitScope(\_:).
326+
///
311327
@inlinable func onUpdateScope(of view: DiffableTextFieldID) -> some View {
312328
environment(\.diffableTextField_onUpdate, nil)
313329
}
@@ -316,11 +332,19 @@ public extension View {
316332
// MARK: Submit
317333
//=------------------------------------------------------------------------=
318334

335+
/// Adds an action to perform when the user submits a value to this view.
336+
///
337+
/// DiffableTextField will trigger this action when the user hits the return key.
338+
///
319339
@inlinable func onSubmit(of view: DiffableTextFieldID,
320340
_ action: @escaping (ProxyTextField) -> Void) -> some View {
321341
environment(\.diffableTextField_onSubmit, Trigger(action))
322342
}
323343

344+
/// Prevents this view from invoking actions from above this view in the view hierarchy.
345+
///
346+
/// It is similar to SwiftUI.View/submitScope(\_:).
347+
///
324348
@inlinable func onSubmitScope(of view: DiffableTextFieldID) -> some View {
325349
environment(\.diffableTextField_onSubmit, nil)
326350
}

0 commit comments

Comments
 (0)