Skip to content

Commit cfa97c6

Browse files
committed
Removed: Lock (made obsolete by f930ce4)
1 parent f930ce4 commit cfa97c6

File tree

3 files changed

+13
-201
lines changed

3 files changed

+13
-201
lines changed

Sources/DiffableTextKit/Utilities/Lock.swift

Lines changed: 0 additions & 69 deletions
This file was deleted.

Sources/DiffableTextKitXUIKit/DiffableTextField.swift

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,10 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
9393
// MARK: State
9494
//=--------------------------------------------------------------------=
9595

96-
@usableFromInline let lock = Lock()
97-
@usableFromInline var update = Update()
98-
9996
@usableFromInline var cache: Cache!
10097
@usableFromInline var context: Context!
101-
98+
@usableFromInline var update = Update()
99+
102100
@usableFromInline var upstream: Upstream<Style>!
103101
@usableFromInline let downstream = Downstream()
104102
@usableFromInline var sidestream = Sidestream()
@@ -168,7 +166,7 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
168166
//=----------------------------------=
169167
// Lock
170168
//=----------------------------------=
171-
if lock.isLocked { return false }
169+
guard !update else { return false }
172170
//=----------------------------------=
173171
// Pull
174172
//=----------------------------------=
@@ -183,10 +181,6 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
183181
// Push
184182
//=------------------------------=
185183
self.push(update)
186-
self.lock.task {
187-
// option + backspace
188-
self.push(.selection)
189-
}
190184
//=----------------------------------=
191185
// Cancellation
192186
//=----------------------------------=
@@ -215,7 +209,7 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
215209
//=------------------------------=
216210
// Lock
217211
//=------------------------------=
218-
if lock.isLocked { return }
212+
guard !update else { return }
219213
//=------------------------------=
220214
// Pull
221215
//=------------------------------=
@@ -285,21 +279,16 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
285279
return
286280
}
287281
//=----------------------------------=
288-
// Lock
282+
// Text
289283
//=----------------------------------=
290-
self.lock.perform {
291-
//=------------------------------=
292-
// Text
293-
//=------------------------------=
294-
if let _ = self.update.remove(.text) {
295-
self.downstream.text = context.text
296-
}
297-
//=------------------------------=
298-
// Selection
299-
//=------------------------------=
300-
if let _ = self.update.remove(.selection) {
301-
self.downstream.selection = context.selection()
302-
}
284+
if let _ = self.update.remove(.text) {
285+
self.downstream.text = context.text
286+
}
287+
//=----------------------------------=
288+
// Selection
289+
//=----------------------------------=
290+
if let _ = self.update.remove(.selection) {
291+
self.downstream.selection = context.selection()
303292
}
304293
}
305294
}

Tests/DiffableTextKitTests/Utilities/Lock.swift

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)