Skip to content

Commit 2550ae3

Browse files
committed
Cleanup. Comment about equals(_:).
1 parent 4569f85 commit 2550ae3

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

Sources/DiffableTextStylesXWrapper/Equals.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import DiffableTextKit
1717
///
1818
/// Use this wrapper to optimize the comparison on view update.
1919
///
20+
/// - Note: DiffableTextView updates its style only when the proposed style is inequal.
21+
///
2022
public struct EqualsTextStyle<Style: DiffableTextStyle, Proxy: Equatable>: WrapperTextStyle {
2123

2224
//=------------------------------------------------------------------------=
@@ -67,6 +69,8 @@ extension DiffableTextStyle {
6769
///
6870
/// Use this wrapper to optimize the comparison on view update.
6971
///
72+
/// - Note: DiffableTextView updates its style only when the proposed style is inequal.
73+
///
7074
@inlinable @inline(__always)
7175
public func equals(_ proxy: Void) -> EqualsVoid {
7276
Equals(self, proxy: _Void())
@@ -76,6 +80,8 @@ extension DiffableTextStyle {
7680
///
7781
/// Use this wrapper to optimize the comparison on view update.
7882
///
83+
/// - Note: DiffableTextView updates its style only when the proposed style is inequal.
84+
///
7985
@inlinable @inline(__always)
8086
public func equals<Proxy>(_ proxy: Proxy) -> Equals<Proxy> {
8187
Equals(self, proxy: proxy)

Sources/DiffableTextViewsXiOS/DiffableTextField.swift

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,6 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
9292
@usableFromInline private(set) var downstream: Downstream!
9393
@usableFromInline private(set) var environment: EnvironmentValues!
9494

95-
//=--------------------------------------------------------------------=
96-
// MARK: Accessors
97-
//=--------------------------------------------------------------------=
98-
99-
@inlinable func pull() -> Update {
100-
Update(focus: downstream.focus,
101-
value: upstream.value.wrappedValue,
102-
style: upstream.style.locale(environment.locale))
103-
}
104-
10595
//=--------------------------------------------------------------------=
10696
// MARK: View Life Cycle
10797
//=--------------------------------------------------------------------=
@@ -131,6 +121,15 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
131121
//=----------------------------------=
132122
context.focus.value ? self.push() : self.write()
133123
}
124+
125+
@inlinable func pull() -> Update {
126+
//=----------------------------------=
127+
// MARK: Upstream, Downstream
128+
//=----------------------------------=
129+
Update(focus: downstream.focus,
130+
value: upstream.value.wrappedValue,
131+
style: upstream.style.locale(environment.locale))
132+
}
134133

135134
@inlinable func push() {
136135
//=----------------------------------=

0 commit comments

Comments
 (0)