Skip to content

Commit e4326e9

Browse files
committed
Added a disclaimer about the use of .equals(_:).
1 parent 3e16c75 commit e4326e9

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

Sources/DiffableTextStylesXWrapper/Equals.swift

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ import DiffableTextKit
1313
// MARK: * Equals
1414
//*============================================================================*
1515

16-
/// A style that equals a proxy value.
16+
/// A style that binds its comparison to a proxy value.
1717
///
18-
/// Use this style to optimize the comparison on view update.
18+
/// Use this wrapper to optimize the comparison on view update.
19+
///
20+
/// - Note: Use it only when you are know that the proxy value represents the state of the style,
21+
/// otherwise the user may lock themselves in state where all or some input is invalid. A state like this
22+
/// corrects itself only when the value or the editing mode changes.
1923
///
2024
public struct EqualsTextStyle<Style: DiffableTextStyle, Proxy: Equatable>: WrapperTextStyle {
2125

@@ -63,13 +67,27 @@ extension DiffableTextStyle {
6367
// MARK: Transformations
6468
//=------------------------------------------------------------------------=
6569

66-
/// Binds the style's comparison result to the proxy value.
70+
/// Binds the style's comparison to a proxy value.
71+
///
72+
/// Use this wrapper to optimize the comparison on view update.
73+
///
74+
/// - Note: Use it only when you are know that the proxy value represents the state of the style,
75+
/// otherwise the user may lock themselves in state where all or some input is invalid. A state like this
76+
/// corrects itself only when the value or the editing mode changes.
77+
///
6778
@inlinable @inline(__always)
6879
public func equals(_ proxy: Void) -> EqualsVoid {
6980
Equals(self, proxy: _Void())
7081
}
7182

72-
/// Binds the style's comparison result to the proxy value.
83+
/// Binds the style's comparison to a proxy value.
84+
///
85+
/// Use this wrapper to optimize the comparison on view update.
86+
///
87+
/// - Note: Use it only when you are know that the proxy value represents the state of the style,
88+
/// otherwise the user may lock themselves in state where all or some input is invalid. A state like this
89+
/// corrects itself only when the value or the editing mode changes.
90+
///
7391
@inlinable @inline(__always)
7492
public func equals<Proxy>(_ proxy: Proxy) -> Equals<Proxy> {
7593
Equals(self, proxy: proxy)

0 commit comments

Comments
 (0)